Commit graph

204 commits

Author SHA1 Message Date
Jan Nieuwenhuizen 01177f7324 mescc: Have micro-mes print argc.
* module/language/c99/compiler.mes (accu->ident): New function.
  (statement->text+symbols+locals): Use it to implement initialization
  with immediate, local.
  (_start): Call main with argc,argv [WAS: 0,0].
* module/mes/libc-i386.mes (i386:push-accu, i386:accu->local): New
  functions.
* module/mes/libc-i386.scm: Export them.
* doc/examples/micro-mes.c (main): Return argc as exit status.
2017-01-03 12:52:59 +01:00
Jan Nieuwenhuizen 109cbdd1e7 mescc: Formals, local variables.
* module/language/c99/compiler.mes (statement->text+symbols+locals):
  Rename from statement->text+symbols.  Handle locals.
  (formals->text): Add proper function preamble.
  (formals->locals): Add formals as locals.
  (expr->accu, ident->accu, ident->base, ident-ref, global-ref): New
  functions.
  (strlen, eputs, fputs, puts): New functions.
  (libc): New variable.
  (i386:libc): Rename from libc.  Remove eputs and puts.
* module/mes/libc-i386.mes (i386:eputs, i386:puts: Remove.
  (i386:call, i386:ret): Handle locals as argument.
  (i386:function-locals, i386:function-preamble, i386:jump,
  i386:local->accu, i386:local-add, i386:local-assign,
  i386:local->base, i386:ref-global, i386:ref-local, i386:ret-local,
  i386:mem-byte->accu, i386:test-jump, i386:write): New functions.
* module/mes/libc-i386.scm: Export them.
2017-01-02 23:21:33 +01:00
Jan Nieuwenhuizen 0315d42306 mini-mes: Parse with Nyacc.
* doc/examples/mini-mes.c: Parse with Nyacc.
2017-01-02 07:50:44 +01:00
Jan Nieuwenhuizen 8989dab8b0 mescc: Scaffolding of Nyacc compile experiments.
* scaffold/micro-mes.c: New file.
* scaffold/mini-mes.c: New file.
* GNUmakefile (mini-mes, micro-mes): New targets.
* .gitignore: Ignore them.
2017-04-02 12:01:33 +02:00