1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 04:10:18 +02:00
Commit graph

8 commits

Author SHA1 Message Date
Ian Price
ddb685ee52 Compile Lua's ... form.
* module/language/lua/compile-tree-il.scm (compile): Add clause for
  ast-variable-arguments.
* module/language/lua/parser.scm (define-ast, make-parser): Add
  vararg-gensym field to functions, gensym field to variable-arguments.
  Propagate *vararg-gensym* from functions to variable-arguments.
* test-suite/tests/lua-eval-2.test ("lua-eval"): Check for #nil
2013-09-09 17:01:24 +01:00
Phil
f4c44a3ba7 Add some documentation. Function calls now properly handle multiple
values resulting from a function call as the last argument.

doc/ref/api-languages.texi: Add a small blurb about Lua.

module/language/lua/compile-tree-il.scm: Function calls now properly
handle multiple values resulting from a function call as the last
argument.
2013-09-09 17:01:24 +01:00
Phil
faa16f9989 module/language/lua/parser.scm: Rename #:dots to #:varargs 2013-09-09 17:01:24 +01:00
Phil
becaec9a4e Fix and/or double evaluation. Add math.modf, math.fmod.
* module/language/lua/compile-tree-il.scm: Fix and/or double evaluation.

* module/language/lua/notes.org: Add file describing known issues.

* module/language/lua/parser.scm: (token-type): Recognize and/or.

* module/language/lua/standard/math.scm: Add modf, fmod implementations.

* test-suite/tests/lua-eval-3.test: Add another test file for basic
  language features.
2013-09-09 17:01:24 +01:00
Andy Wingo
04175c7dda lua/lexer tweaks
* module/language/lua/lexer.scm: Some tweaks and reindentations. Remove
  the define/init lexer interface; I don't like separating declaration
  and initialization.

* module/language/lua/parser.scm:
* test-suite/tests/lua-lexer.test: Adapt to lexer interface change.
2013-09-09 17:01:24 +01:00
Andy Wingo
48f7c66a40 lua/parser tweaks
* module/language/lua/parser.scm (define-record, define-ast): Simplify
  these macros.
  (make-parser): A number of small idiomatic changes.
2013-09-09 17:01:23 +01:00
Andy Wingo
a0cecd8ff2 lua/common cleanup
* module/language/lua/common.scm: Remove `or-eqv?'. Make a bit more
  idiomatic.

* module/language/lua/compile-tree-il.scm:
* module/language/lua/lexer.scm:
* module/language/lua/parser.scm:
* module/language/lua/runtime.scm: Replace or-eqv? instances with memq
  or memv.
2013-09-09 17:01:23 +01:00
No Itisnt
a30c18c22a add lua language implementation
What is missing:

+ Functions: module, getfenv, setfenv, math.modf, table.sort

+ Parser: needs to be more flexible

+ Compiler: needs more extensive work to properly handle all possible
cases of variable arguments, multiple returns, and loops

+ Language: Variable arguments and unpacking of multiple returns. (For
example we need to be able to handle something as complex as
print(unpack({...})), which is easy with Lua's explicit stack but will
require lots of tree-il gymnastics, or perhaps modifications to better
allow different calling conventions. (For instance -- how would we
support Python or Ruby, where keyword arguments are gathered into a
hashtable and passed as a single argument?)

What is there:

A fair shot at supporting Lua 5.1, not quite a drop-in replacement, but
not far from that goal either.
2013-09-09 17:01:23 +01:00