* 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
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.
* 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.
* module/language/lua/runtime.scm (true?, false?): Remove, now that #nil
is false.
* module/language/lua/compile-tree-il.scm: Don't emit calls to true? or
false?.
* 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.
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.
* libguile/ports.c (scm_ungetc_unlocked): Inline the conversion from
codepoint to bytes for UTF-8 and latin-1 ports. Speeds up a
numbers-reading test case by 100% (!).
* module/language/tree-il/compile-cps.scm: New module implementing CPS
conversion of Tree-IL.
* module/Makefile.am:
* module/language/tree-il/spec.scm:
* module/language/cps/spec.scm: Integrate CPS in the build and language
system.
* module/scripts/disassemble.scm (disassemble): Update to work with
RTl (and only RTL, as that's the future).
* module/system/vm/debug.scm (for-each-elf-symbol): New public
interface.
(debug-context-from-image): New helper.
(find-debug-context): Use the helper.
* module/system/vm/disassembler.scm (disassemble-image): New public
interface.
* module/system/vm/assembler.scm (link-data): Give stringbufs the
"shared" flag already, so we don't attempt to set it at runtime. Give
.data sections the SHF_WRITE flag.
* module/system/base/compile.scm (compile-file): Pass #:to-disk? as an
option to indicate that the result will be being loaded from disk.
Perhaps a linker might want to page-align in that case.
* module/language/elisp/compile-tree-il.scm (process-options!): Accept
and ignore the #:to-file compiler option.
* libguile/vm-engine.c (return-values): Remove NVALUES operand.
Don't reset the frame.
* test-suite/tests/rtl.test ("cached-toplevel-set!"): Adapt to the fact
that 'return-values' has no operand now, and that 'reset-frame' must
be done first.
* module/language/tree-il/primitives.scm (maybe-simplify-to-eq): Wrap
within another lambda, binding the primitive name. If there are less
than two arguments, expand to constant #t. If there are more than two
arguments, convert into a conjunction of binary applications.
(expand-chained-comparisons): New procedure.
(*primitive-expand-table*): Add entries for (< <= = >= > eq?).
* module/ice-9/curried-definitions.scm (cdefine, cdefine*): Simplify,
and improve error reporting by making the patterns more strict.
(define-public): Fix bug in generated 'export' form.
* module/ice-9/boot-9.scm (module-add!): Check that the symbol argument
is actually a symbol.
(define-public): Expand into 'define' in such a way that curried
definitions will immediately fail.
Fixes <http://bugs.gnu.org/15100>.
Reported by Göran Weinholt <goran@weinholt.se>.
* libguile/bytevectors.c (INTEGERS_TO_LIST): Enforce the R6RS
requirement that SIZE divides the bytevector length.
* test-suite/tests/bytevectors.test: Add test. Remove tests that
assumes that this "divides" check is not enforced.
Partially fixes <http://bugs.gnu.org/15100>.
Reported by Göran Weinholt <goran@weinholt.se>.
* libguile/bytevectors.c (INTEGERS_TO_LIST): Make sure SIZE isn't 0.
Allow SIZE to be greater than the bytevector length, for consistency
with allowing extra bytes at the end when the bytevector length is
non-zero. Use scm_from_size_t instead of scm_from_uint.
* test-suite/tests/bytevectors.test: Add tests. Remove a test that
checks for an exception when SIZE is greater than the bytevector
length.