1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00
Commit graph

41 commits

Author SHA1 Message Date
Andy Wingo
5c6b3c5169 Fix test suite for constant literals change
* test-suite/tests/elisp-compiler.test ("List Built-Ins"): Avoid
  mutating a literal pair.  If this turns out to be necessary for elisp,
  the compiler will have to compile literals to calls to run-time heap
  allocations rather than constants.
2017-04-19 09:26:11 +02:00
BT Templeton
0e5b7e74e4 fix `flet' syntax
* module/language/elisp/compile-tree-il.scm (process-let-bindings):
  Remove.

  (parse-let-binding, parse-flet-binding): New procedures.

  (generate-let, generate-let*): Now takes an association list mapping
  symbols to values for the `bindings' argument.

  (compile-let, compile-let*, compile-lexical-let)
  (compile-lexical-let*): Parse the bindings list with
  `parse-let-binding'.

  (compile-flet): Parse the bindings list with `parse-flet-binding'.
2012-02-03 18:53:50 -05:00
BT Templeton
f6e0a4a60c elisp binding declarations
* module/language/elisp/compile-tree-il.scm (bind-lexically?): Accept a
  new `decls' argument and check it for `lexical' declarations.
  Establish the same kind of binding whether or not a lexical binding
  for `sym' exists, whereas previously the presence of a lexical binding
  would cause newly-established bindings to be lexical bindings as well.

  (split-let-bindings): Remove. All callers changed.

  (generate-let, generate-let*, compile-lambda): Pass the declarations
  list to `bind-lexically?'.

* test-suite/tests/elisp-compiler.test: Explicitly disable the
  lexical-binding mode. Add `lexical' declarations where necessary.
2012-02-03 18:53:50 -05:00
BT Templeton
1631817977 elisp lambda list parsing
* module/language/elisp/compile-tree-il.scm (split-lambda-arguments):
  Remove.

  (parse-lambda-list, make-simple-lambda): New procedures.

  (compile-lambda): Use `parse-lambda-list' and `make-simple-lambda'.
  Set empty rest arguments to the empty list instead of `#nil'.

* test-suite/tests/elisp-compiler.test ("Lambda Expressions")["rest
  argument"]: Use Elisp `null' instead of a Scheme equality check.
2012-02-03 18:53:49 -05:00
BT Templeton
48489836e2 evaluate the function position correctly
* module/language/elisp/compile-tree-il (compile-pair): Use `function'
  to perform functional evaluation. Previously, if the operator of a
  compound form was not a symbol, the operator would be evaluated as a
  normal expression. This happened to work only because there is a
  `lambda' macro. The compiler will now signal an error if the operator
  is neither a function name nor a lambda expression.

* test-suite/tests/elisp-compiler.test ("Lambda Expressions")["optional
  argument"]: Remove an erroneous use of `function' in the function
  position.
2012-02-03 18:53:49 -05:00
BT Templeton
0a32abc462 remove `flet*' elisp special form
* module/language/elisp/compile-tree-il.scm (compile-flet*): Remove.
* module/language/elisp/runtime/function-slot.scm: Update module
  definition.
* test-suite/tests/elisp-compiler.test
  ("Lambda Expressions")["flet and flet*"]: Remove `flet*' test.
2012-02-03 18:53:49 -05:00
BT Templeton
e5a361d1f9 remove `with-always-lexical' elisp special form
* module/language/elisp/compile-tree-il.scm: (always-lexical): Remove.
  All uses changed.
  (with-added-symbols): Remove.
  (compile-with-always-lexical): Remove.
  (process-options!): Remove support for the `#:always-lexical' option.
* module/language/elisp/runtime/function-slot.scm: Update import and
  re-export lists.
* test-suite/tests/elisp-compiler.test: Remove or update tests using
  `with-always-lexical'.
2012-02-03 18:53:49 -05:00
BT Templeton
03e00c5c9d emacs-compatible lexical binding
* module/language/elisp/bindings.scm (global?): New function.
* module/language/elisp/compile-tree-il.scm (lexical-binding): New
  variable.
  (bind-lexically?): If lexical binding is enabled, bind lexically
  unless a special binding exists.
  (compile-%set-lexical-binding-mode): New function.
* module/language/elisp/lexer.scm (lexical-binding-regexp): New
  variable.
  (lex): Return a `set-lexical-binding-mode!' token if a comment is
  found while reading the first line.
* module/language/elisp/parser.scm (get-expression): Add support for
  `set-lexical-binding-mode!' tokens.
* module/language/elisp/runtime/function-slot.scm: Import and re-export
  the `%set-lexical-binding-mode' special form.
* test-suite/tests/elisp-compiler.test
  ("Let and Let*")["lambda args inside lexical-let"]: Update.
2012-02-03 18:53:49 -05:00
BT Templeton
d5ac6923c3 fix compilation of elisp forms with empty bodies
* module/language/elisp/compile-tree-il.scm (generate-let)
  (generate-let*, compile-lambda, compile-with-added-symbols)
  (compile-progn, compile-if): Return nil if the form's body is empty.
* test-suite/tests/elisp-compiler.test ("Sequencing")["empty progn"]:
  New test.
  ("Conditionals")["if with no else"]: New test.
  ("Let and Let*")["empty let, empty let*"]: New test.
  ("Lambda Expressions")["empty lambda"]: New test.
2012-02-03 18:53:48 -05:00
BT Templeton
a338fa3d87 remove unnecessary elisp macros
* module/language/elisp/runtime/macros.scm (when, unless, dotimes)
  (dolist, pop, push): Remove. (They are not special forms in Emacs.)

* module/language/elisp/runtime/function-slot.scm: Update import and
  export lists.

* test-suite/tests/elisp-compiler.test ("Conditionals")["failing when"]
  ["succeeding when", "failing unless", "succeeding unless"]: Remove.
  ("Iteration")["dotimes", "dolist"]: Remove.
  ("List Built-Ins")["pop", "push"]: Remove.
2012-02-03 18:53:48 -05:00
BT Templeton
59e46065ce elisp test fixes
* test-suite/tests/elisp-compiler.test ("Exceptions")["catch and
  throw"]: Use a freshly-consed object instead of a literal object. This
  test previously assumed that similar literal objects are never
  identical, which no longer true.
  ("Equivalence Predifcates")["eq"]: Likewise.
2012-02-03 18:53:48 -05:00
BT Templeton
b0a9f1b4b4 remove unnecessary elisp subrs
* module/language/elisp/runtime/subrs.scm (copy-tree, number-sequence):
  Remove. (They are not subrs in Emacs.)

* test-suite/tests/elisp-compiler.test ("List Built-ins")["copy-tree",
  "number-sequence"]: Remove.
2012-02-03 18:53:48 -05:00
BT Templeton
16254e5a09 atomp' -> atom'
* module/language/elisp/runtime/subrs.scm (atomp) Rename to...
  (atom): ...this. All callers changed.
2012-02-03 18:53:48 -05:00
Brian Templeton
c6920dc8ba lexical function binding for elisp
* module/language/elisp/compile-tree-il.scm (access-variable)
  (reference-variable, set-variable!): Handle globally-bound non-special
  variables.

  (bind-lexically?): Create lexical bindings for flet and flet*.

* module/language/elisp/runtime.scm (reference-variable, set-variable!):
  Handle globally-bound non-special variables.

  (built-in-func): Set the variable directly instead of storing the
  function in a fluid.

* module/language/elisp/runtime/subrs.scm (funcall): Call apply
  directly.

* test-suite/tests/elisp-compiler.test ("Function Definitions")["flet
  and flet*"]:

Signed-off-by: Andy Wingo <wingo@pobox.com>
2010-12-07 13:21:03 +01:00
Brian Templeton
3f70b2dc5c use unbound fluids instead of `void' sentinel value
* module/language/elisp/compile-tree-il.scm (reference-with-check)
  (compile-without-void-checks, want-void-check?): Remove.

  (compile-function, compile-pair): Use `reference-variable' instead of
  `reference-with-check'.

  (compile-defvar): Only set `sym' if `sym' is not bound to a bound
  fluid, rather than requiring that its value be `void'.

  (process-options!): Remove `#:disable-void-check' option handling.

* module/language/elisp/runtime.scm (void)
  (reference-variable-with-check): Remove.

  (ensure-fluid!): Use an undefined fluid as the initial value for
  global variables.

* module/language/elisp/runtime/function-slot.scm (without-void-checks):
  Don't import or re-export.

* module/language/elisp/runtime/macros.scm (prog1, cond, or, dolist):
  Don't use `without-void-checks'.

* module/language/elisp/runtime/subrs.scm (symbol-value)
  (symbol-function, apply): Use `reference-variable' instead of
  `reference-variable-with-check'.

  (makunbound, fmakunbound, boundp, fboundp): Unset the variable's fluid
  (or the variable itself, if it isn't bound to a fluid).

* test-suite/tests/elisp-compiler.test ("Variable
  Setting/Referencing")["disabled void check (all)", "disabled void
  check (symbol list)", "without-void-checks"]: Remove.

Signed-off-by: Andy Wingo <wingo@pobox.com>
2010-12-07 13:21:03 +01:00
Brian Templeton
0dbfdeefc6 use correct names for quasiquotation operators
Use #{`}#, #{,}# and #{,@}# as the quasiquote, unquote and
unquote-splicing operators, respectively. Previously they were named
escaping.

* module/language/elisp/compile-tree-il.scm (unquote?): Change "\," to
  "#{,}#".
  (unquote-splicing): Change "\,@" to "#{,@}#".
  (#{compile-`}#): Rename from #{compile-\`}#.
* module/language/elisp/runtime/function-slot.scm: Import #{compile-`}#
  instead of #{compile-\`}#, and re-export as #{`}# instead of as
  #{\`}#.
* module/language/elisp/parser.scm (quotation-symbols):
* test-suite/tests/elisp-compiler.test ("Eval", "Quotation"):
* test-suite/tests/elisp-reader.test ("Parser"): Change "\`", "\,", and
  "\,@" to "#{`}#", "#{,}#" and "#{,@}#", respectively.
2010-12-07 13:21:02 +01:00
Brian Templeton
450cb50419 make pass-if-equal' literal in compile-test'
* test-suite/tests/elisp-compiler.test (compile-test): Add
  `pass-if-equal' to the list of literal identifiers

Signed-off-by: Andy Wingo <wingo@pobox.com>
2010-12-07 13:21:01 +01:00
Andy Wingo
92a61010bd change remaining %nil -> #nil
* doc/ref/vm.texi:
* libguile/boolean.h:
* libguile/pairs.h:
* module/language/elisp/README:
* test-suite/tests/elisp-compiler.test:
* test-suite/tests/load.test: Change remaining mentions of %nil to #nil.
2010-04-09 21:06:29 +02:00
Daniel Kraft
dfbc6e9d54 Allow lexical binding of lambda arguments.
* module/language/elisp/compile-tree-il.scm: Rework lambda compiler to allow
  opional lexical binding of (some) lambda arguments.
* test-suite/tests/elisp-compiler.test: Check this.
2009-08-01 13:00:27 +02:00
Daniel Kraft
c808c926fd Compiler option to always bind certain symbols lexically.
Affects so far let-bound symbols, lambda arguments to come in the future.

* module/language/elisp/README: Document it.
* module/language/elisp/compile-tree-il.scm: Add :always-lexical option.
* test-suite/tests/elisp-compiler.test: Test it.
2009-07-31 18:00:01 +02:00
Daniel Kraft
ce305387df Switch use of guile-primitive to now available funcall in test. 2009-07-30 13:54:07 +02:00
Daniel Kraft
f3df67e203 without-void-checks as new extension for fine-control
* module/language/elisp/README: Document it.
* module/language/elisp/compile-tree-il.scm: Handle without-void-checks.
* test-suite/tests/elisp-compiler.test: Test it.
2009-07-30 13:51:45 +02:00
Daniel Kraft
e96a9591ce funcall, apply and eval built-ins.
* module/language/elisp/README: Document new features.
* module/language/elisp/runtime/function-slot.scm: Implement funcall, apply and
  eval by using the existing compiler code.
* test-suite/tests/elisp-compiler.test: Test those.
2009-07-29 16:27:45 +02:00
Daniel Kraft
c61ec8e29e Added guile-primitive construct for references to primitives from Elisp.
* module/language/elisp/README: Document it.
* module/language/elisp/compile-tree-il.scm: Implement guile-primitive.
* test-suite/tests/elisp-compiler.test: Switched a usage of guile-ref to
  the now available guile-primitive.
2009-07-29 14:25:33 +02:00
Daniel Kraft
c2c7c27755 Added length built-in.
* module/language/elisp/runtime/function-slot.scm: Add length built-in.
* test-suite/tests/elisp-compiler.test: Test length.
2009-07-29 13:45:40 +02:00
Daniel Kraft
a6a5cf03d4 Implemented lexical-let and lexical-let* for elisp.
* module/language/elisp/README: Document it.
* module/language/elisp/bindings.scm: New fields in bindings data structure
  to keep track of lexical bindings for symbols.
* module/language/elisp/compile-tree-il.scm: Implement lexical-let(*).
* test-suite/tests/elisp-compiler.test: Test lexical scoping with lexical-let.
2009-07-29 12:09:43 +02:00
Daniel Kraft
fd40f371a6 In elisp-compiler.test, check that let* works without values given, too. 2009-07-27 10:55:23 +02:00
Daniel Kraft
a089997441 Compiler option to disable void-checks in elisp.
* module/language/elisp/README: Document the change.
* module/language/elisp/compile-tree-il.scm: Add disable-void-check option.
* test-suite/tests/elisp-compiler.test: Test it.
2009-07-24 11:09:57 +02:00
Daniel Kraft
e8f18b3f63 Implemented the flet and flet* extensions.
* module/language/elisp/README: Document it.
* module/language/elisp/compile-tree-il.scm: Implement flet and flet*.
* test-suite/tests/elisp-compiler.test: Test flet and flet*.
2009-07-24 09:56:13 +02:00
Daniel Kraft
3709984696 Implemented dynamic symbol access built-ins (set, fset, symbol-value, makunbound...)
* module/language/elisp/README: Document it.
* module/language/elisp/compile-tree-il.scm: Moved ensure-fluid! to runtime function.
* module/language/elisp/runtime.scm: Runtime functions to support dynamic value access.
* module/language/elisp/runtime/function-slot.scm: Defined the built-ins.
* test-suite/tests/elisp-compiler.test: Test them.
2009-07-23 14:09:55 +02:00
Daniel Kraft
33da12eeff Added guile-ref extension construct, change throw implementation to easier one using a built-in function and implement unwind-protect.
* module/language/elisp/README: Document the changes.
* module/language/elisp/compile-tree-il.scm: Implement unwind-protect.
* module/language/elisp/runtime/function-slot.scm: throw as built-in.
* test-suite/tests/elisp-compiler.test: Test unwind-protect.
2009-07-22 12:50:56 +02:00
Daniel Kraft
35b2e41d6d Implemented catch and throw in elisp.
* module/language/elisp/README: Document this.
* module/language/elisp/compile-tree-il.scm: Implement catch and throw.
* test-suite/tests/elisp-compiler.test: Test catch/throw.
2009-07-22 12:23:03 +02:00
Daniel Kraft
fb66a47a8e Implemented prog1, prog2, dotimes, dolist control structures.
* module/language/elisp/README: Document it and some further ideas written down.
* module/language/elisp/compile-tree-il.scm: Implement prog1, dolist.
* module/language/elisp/runtime/macro-slot.scm: prog2 and dotimes.
* test-suite/tests/elisp-compiler.test: Test prog1, prog2, dotimes, dolist.
2009-07-20 20:52:00 +02:00
Daniel Kraft
f614ca12cd Implemented some important list built-ins.
* module/language/elisp/runtime.scm: Updated/added convenience macros.
* module/language/elisp/runtime/function-slot.scm: Implement list built-ins.
* module/language/elisp/runtime/macro-slot.scm: Implement list built-ins.
* test-suite/tests/elisp-compiler.test: Test the implemented built-ins.
2009-07-18 20:10:24 +02:00
Daniel Kraft
7d1a978289 Implemented unless, when and dotimes using built-in macros.
* module/language/elisp/README: Document that.
* module/language/elisp/runtime.scm: Defined built-in-macro macro.
* module/language/elisp/runtime/macro-slot.scm: Implement unless, when, dotimes.
* test-suite/tests/elisp-compiler.test: Test for those constructs.
2009-07-18 18:38:42 +02:00
Daniel Kraft
570c12aca7 Return correct value for setq form.
* module/language/elisp/compile-tree-il.scm: Fix implementation of setq.
* test-suite/tests/elisp-compiler.test: Check for value of setq form.
2009-07-18 17:58:01 +02:00
Daniel Kraft
9b5ff6a6e1 Implemented real quotation (added support for backquotation).
* module/language/elisp/README: Document that.
* module/language/elisp/compile-tree-il.scm: Implement backquote.
* test-suite/tests/elisp-compiler.test: Test quotation and backquotes.
2009-07-18 17:32:59 +02:00
Daniel Kraft
e905e490fa Implemented eq and equal built-in predicates.
* module/language/elisp/runtime/function-slot.scm: Implement eq and equal.
* test-suite/tests/elisp-compiler.test: Test them.
2009-07-18 17:21:55 +02:00
Daniel Kraft
74c009dadc Implemented macros in elisp compiler.
* module/language/elisp/README: Document it.
* module/language/elisp/compile-tree-il.scm: Implement defmacro and expansion.
* module/language/elisp/runtime/macro-slot.scm: New module to keep definitions.
* test-suite/Makefile.am: Add elisp-compiler.test to list of tests.
* test-suite/tests/elisp-compiler.test: Basic macro tests.
2009-07-16 15:23:38 +02:00
Daniel Kraft
b6b9d59604 Extended test-suite to cover already implemented built-ins and fixed errors found.
* module/language/elisp/runtime/function-slot.scm: Fixed errors in number preds.
* test-suite/tests/elisp-compiler.test: Test built-ins already implemented.
2009-07-16 14:28:07 +02:00
Daniel Kraft
d158fa62ab Test-suite for elisp compiler so far, excluding the built-ins.
* test-suite/tests/elisp-compiler.test: Tests for compiler so far.
2009-07-15 22:08:36 +02:00