Commit graph

365 commits

Author SHA1 Message Date
Jan Nieuwenhuizen f612feec47 core+mini-mes: Move function name to struct function.
* module/language/c99/compiler.mes (expr->arg): Handle char arguments.
* doc/examples/cons-mes.c (struct function): Add name field.
* doc/examples/mini-mes.c: Likewise.
  (mes_builtins): Update.
* mes.c: Likewise.
* build-aux/mes-snarf.scm: Update.
2017-03-09 23:27:12 +01:00
Jan Nieuwenhuizen 78e70f9024 mescc: Support struct assignment.
* module/mes/libc-i386.mes (i386:base-address->accu-address,
  i386:accu+n, i386:base+n): New functions.
* module/mes/libc-i386.scm: Export them.
* module/language/c99/compiler.mes (ast->info): Use them.
* doc/examples/t.c: Test them.
* doc/examples/cons-mes.c: Drop workarounds.
* doc/examples/mini-mes.c: Likewise.
* mes.c:
2017-03-02 20:26:13 +01:00
Jan Nieuwenhuizen 43a1774750 core: Move GNUisms inside #if.
* mes.c: Move GNUisms inside #if, add Nyacc #ifs.
 (tmp_num2, tmp_num3): Remove.
 (make_tmps): Update.
 (g_free): Make simple int.  Update users.
* lib.c: Update users.
* build-aux/mes-snarf.scm (GCC?): New switch to enable GNU extensions.
2017-01-04 08:16:14 +01:00
Jan Nieuwenhuizen 2ae1eec0eb core: Move GNUisms inside #if.
* mes.c: Move GNUisms inside #if, add Nyacc #ifs.
 (tmp_num2, tmp_num3): Remove.
 (make_tmps): Update.
 (g_free): Make simple int.  Update users.
* lib.c: Update users.
* build-aux/mes-snarf.scm (GCC?): New switch to enable GNU extensions.
2017-01-04 10:52:36 +01:00
Jan Nieuwenhuizen 16e3caafcd core: Remove display.
* posix.c (stderr_): New function.
* display.c: Remove.
* mes.c: Remove includes.  Use stderr_ instead of display_.
 (gc_loop): Preserve function's name.
 (arity_): New function.
* GNUmakefile (mes.o): Remove dependency on display.
* module/mes/read-0.mes: Use core:stderr instead of display, newline.
  (newline): New function.
* module/mes/base-0.mes: Use core:stderr instead of display.
  Include (mes display).
* module/mes/display.mes: New file.
* lib.c (assert_defined): Move from mes.c.
  (string_to_cstring): Move from posix.c
* build-aux/mes-snarf.scm (function-environment): Initialize function
  name with scheme string.
2016-12-24 01:23:50 +01:00
Jan Nieuwenhuizen 18ba10e2ae core: Simplify lookup.
* reader.c (lookup_): Rename from lookup.  Remove all lookups except
  for numbers and symbols.  Update callers.
* mes.c (make_symbol_): Rename from internal_make_symbol.  Update
  callers.
* module/mes/read-0.mes (lookup): New function.
  (read-word): Remove all lookup calls, except for numbers and symbols.
2016-12-23 11:31:34 +01:00
Jan Nieuwenhuizen aa0aaa58ab core: Cleanup symbol initialization and lookup.
* build-aux/mes-snarf.scm (symbol->names): New function
  (function->environment): Initialize symbol.
  (generate-includes): Also write .symbol-names.i.
* mes.c (mes_symbols): Include it.  Remove internal_lookup_symbol.
* display.c (display): Handle display of nil in symbol list.
* reader.c (internal_lookup_symbol): Remove name-fu.
2016-12-23 10:38:41 +01:00
Jan Nieuwenhuizen 94d1c65bde core: Make symbols constants.
* mes.c (apply_env,eval_env): Rewrite using switch.
* build-aux/mes-snarf.scm (symbol->header): Define constants.
  (symbol->source): Only update g_free and init cells.
2016-12-14 19:02:19 +01:00
Jan Nieuwenhuizen d50b0fe24a core: Add function indirection.
* mes.c (functions): New array.
  (scm_t): Change function pointer to index.
  (make_cell): Handle function.
  (call): Update for function change.
  (display_): Likewise.
  (make_function): New function.
* build-aux/mes-snarf.scm (function->source): Update declarations.
  (function->environment): New function.
2016-12-12 20:35:19 +01:00
Jan Nieuwenhuizen 61e42e8527 core: Number based cells.
* mes.c (scm_t): Change car, string, ref, cdr, macro, vector into g_cell index
  [WAS]: scm_t pointer.
* define.c: Update.
* lib.c: Update.
* math.c: Update.
* posix.c: Update.
* quasiquote.c: Update.
* string.c: Update.
* type.c: Update.
* build-aux/mes-snarf.mes Update.
* tests/gc-4.test: New test.
* tests/gc-5.test: New test.
* tests/gc-6.test: New test.
2016-12-12 20:35:18 +01:00
Jan Nieuwenhuizen 7e8341d76c core: One SCM type for function.
* mes.c (function_t): New struct.
  (type): One type for function.
  (call): Refactor.
* build-aux/mes-snarf.mes: Use arity annotation.  WAS: args.  Update
  annotations.
2016-12-12 20:33:50 +01:00
Jan Nieuwenhuizen c851935d4d core: Quoted internals are symbols.
* mes.c (begin_env): Rename from begin.  Update callers.
  (scm_begin, scm_if, scm_define, scm_set_x): Rename from symbol_*.
  (symbol_begin, symbol_define, symbol_if, scm_lambda, scm_set_x): New symbols.
  (mes_environment): Add them to environment, SYMBOL->SCM.
* define.c (define_env): Rename from define.  Update callers.
* build-aux/mes-snarf.scm: Shadow internals (SCM) by their symbol.
2016-12-12 20:33:49 +01:00
Jan Nieuwenhuizen 2586f0bb2c Move optional type predicates to type.c.
* mes.c (char_p, macro_p, number_p, pair_p, string_p, symbol_p,
  vector_p, builtin_p, boolean_p): Move to type.c
* type.c: New file.
* GNUmakefile (mes.o): Depend on type snarf output.
* module/mes/loop-0.mes (cond, map, let, or, and not, evlis-env,
  apply-env, eval-expand, uquote, add-unquoters, eval,
  expand-macro-env, eval-begin-env, eval-if-env, sexp:define,
  env:define, env:macro): Move to mes-0.mes.
* module/mes/mes-0.mes: New file.
* module/mes/type-0.mes: New file.
* scripts/include.mes: If BOOT, also include mes-0.mes.  If TYPE0,
  also include type-0.mes.
2016-10-22 12:16:19 +02:00
Jan Nieuwenhuizen 3e03a12a4d Generate C header and includes using snarfing.
* mes.c: Move specific renames and n-args to alist annotation.
* build-aux/mes-snarf.scm: New file.
* GNUmakefile (mes.environment.h): Use it.
  (mes.h): Remove.
  (clean): Update.
  (mes.o): New dependency rule.
* .gitignore: Update.
2016-10-21 22:44:50 +02:00
Jan Nieuwenhuizen 3128c4b976 Prepare for 0.1 release: gnu-build-system.
* configure: New file.
* make/install.make: New file.
* .gitignore: Ignore generated files.
* build-aux/gitlog-to-changelog: New file.
2016-10-16 00:34:23 +02:00