summaryrefslogtreecommitdiff
path: root/module/language/elisp
Commit message (Collapse)AuthorAgeFilesLines
* Mark some elisp runtime modules as non-declarativeAndy Wingo2021-04-212-2/+4
| | | | | | * module/language/elisp/runtime/function-slot.scm (language): * module/language/elisp/runtime/value-slot.scm (language): Non-declarative.
* Fix handling of parameter lists to elisp defun to allow nil.Mikael Djurfeldt2021-04-011-0/+1
| | | | Thanks to Vasilij Schneidermann.
* Add copyright header for (language elisp falias), and fix typo.Mark H Weaver2018-08-072-1/+21
| | | | | * module/language/elisp/falias.scm: Add copyright header. * module/language/elisp/spec.scm: Fix typo in header.
* elisp: Fix cross-compilation support.Mark H Weaver2018-08-072-6/+19
| | | | | | | | | * module/system/base/target.scm (with-native-target): New exported procedure. * module/language/elisp/spec.scm: In the top-level body expression, call 'compile-and-load' within 'with-native-target' to compile native code. * module/language/elisp/compile-tree-il.scm (eval-when-compile, defmacro): Compile native code.
* Use make-struct/no-tail instead of make-structAndy Wingo2017-09-201-6/+6
| | | | | | | | | | | | * module/ice-9/boot-9.scm: * module/language/cps/effects-analysis.scm: * module/language/elisp/falias.scm: * module/language/tree-il.scm: * module/language/tree-il/primitives.scm: * module/rnrs/records/procedural.scm: * module/srfi/srfi-35.scm: * module/system/base/syntax.scm: Change uses of make-struct to make-struct/no-tail.
* Fix order of evaluation in elisp lexerAndy Wingo2013-11-011-15/+15
| | | | | * module/language/elisp/lexer.scm (lex): Use let*, to ensure that the port position is read before reading the next char.
* compile-file adds #:to-disk? #t to optsAndy Wingo2013-08-241-1/+1
| | | | | | | | | * 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.
* Remove with-fluids; replaced by with-fluid* and inlined push-fluid primopsAndy Wingo2013-06-281-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/vm-i-system.c (push-fluid, pop-fluid): * doc/ref/vm.texi (Dynamic Environment Instructions): Rename wind-fluids to push-fluid, and unwind-fluids to pop-fluid. They now only work on one fluid binding at a time. * module/ice-9/boot-9.scm (with-fluid*): Implement in Scheme in terms of primcalls to push-fluid and pop-fluid. (custom-throw-handler, catch, with-throw-handler): Use with-fluid* instead of with-fluids, as with-fluids is no longer available before psyntax is loaded. (with-fluids): Define in Scheme in terms of with-fluid*. * libguile/fluids.c (scm_with_fluid): Rename from scm_with_fluids, and don't expose to Scheme. * libguile/eval.c (eval): Remove SCM_M_WITH_FLUIDS case. * libguile/expand.c (expand_with_fluids): Remove with-fluids syntax. (DYNLET): Remove, no longer defining dynlet in the %expanded-vtables. * libguile/expand.h: Remove dynlet definitions. * module/ice-9/eval.scm (primitive-eval): Remove with-fluids case. * libguile/memoize.c (do_push_fluid, do_pop_fluid): New primitive helpers, like wind and unwind. (memoize): Memoize wind and unwind primcalls. Don't memoize dynlet to with-fluids. (scm_init_memoize): Initialize push_fluid and pop_fluid here. * libguile/memoize.h (SCM_M_WITH_FLUIDS): Remove definition. * module/ice-9/psyntax.scm (build-dynlet): Remove; this just supported with-fluids, which is now defined in boot-9. * module/ice-9/psyntax-pp.scm: Regenerate. * doc/ref/compiler.texi (Tree-IL): * module/language/tree-il.scm: * module/language/tree-il/analyze.scm: * module/language/tree-il/canonicalize.scm: * module/language/tree-il/compile-glil.scm: * module/language/tree-il/cse.scm: * module/language/tree-il/debug.scm: * module/language/tree-il/effects.scm: Remove <dynlet>. Add cases for primcalls to push-fluid and pop-fluid in compile-glil.scm and effects.scm. * module/language/tree-il/peval.scm (peval): Factor out with-temporaries; probably a bad idea, but works for now. Factor out make-begin0 (a better idea). Inline primcalls to with-fluid*, and remove dynlet cases. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Add with-fluid*.
* length's argument is a sequenceBT Templeton2012-04-011-1/+5
| | | | | * module/language/elisp/boot.el (length): Use `length' if the argument is a list or `generalized-vector-length' otherwise.
* elisp rngBT Templeton2012-03-081-0/+15
| | | | * module/language/elisp/boot.el (random): New function.
* elisp i/oBT Templeton2012-03-081-0/+13
| | | | | * module/language/elisp/boot.el (send-string-to-terminal) (read-from-minibuffer, prin1-to-string): New functions.
* elisp: symbol-name, internBT Templeton2012-03-081-0/+2
| | | | * module/language/elisp/boot.el (symbol-name, intern): New functions.
* elisp: when, unlessBT Templeton2012-03-081-0/+8
| | | | * module/language/elisp/boot.el (when, unless): New macros.
* elisp sequence functionsBT Templeton2012-03-081-0/+82
| | | | | | | * module/language/elisp/boot.el (nreverse, assoc, assq, rplaca, rplacd) (caar, cadr, cdar, cddr, dolist, stringp, string-equal, string=) (substring, upcase, downcase, string-match, make-vector, mapc, aref) (aset, concat): New functions.
* integerp, wholenump return nil for non-numbersBT Templeton2012-03-081-5/+3
| | | | | | * module/language/elisp/boot.el (integerp, wholenump): Call `integer?' before `exact?' so that these predicates return nil for non-numbers instead of signalling an error.
* use #nil as default for elisp rest parametersBT Templeton2012-03-051-1/+8
| | | | | * module/langauge/elisp/compile-tree-il.scm (compile-lambda): Bind the rest parameter to `#nil' instead of `()' by default.
* Merge branch 'bt/elisp'BT Templeton2012-03-0512-1394/+1077
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: am/guilec libguile/_scm.h libguile/vm-i-scheme.c module/language/elisp/compile-tree-il.scm module/language/elisp/runtime.scm module/language/elisp/runtime/macros.scm module/language/tree-il/compile-glil.scm module/language/tree-il/primitives.scm
| * function binding fixesBT Templeton2012-02-032-62/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * module/language/elisp/bindings.scm (bindings): Add `function-bindings' field. (make-bindings): Initialize the `function-bindings' field. (get-function-binding, with-function-bindings): New functions. (access-variable, reference-variable, set-variable!): Remove the `module' argument and only handle references to the value cell. All callers changed. Callers passing `function-slot' as the module changed to use the corresponding functions for the function cell instead. (access-function, reference-function, set-function!): New procedures. (compile-flet, compile-labels): Use `with-function-bindings' instead of `with-lexical-bindings'.
| * sharpsign-colon for uninterned symbolsBT Templeton2012-02-031-1/+6
| | | | | | | | | | * module/language/elisp/lexer.sm (lex): Add support for `#:' syntax for uninterned symbols.
| * elisp I/OBT Templeton2012-02-031-0/+14
| | | | | | | | | | * module/language/elisp/boot.el (princ, print, terpri, format*): New functions.
| * improve management of global special variablesBT Templeton2012-02-032-151/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * module/language/elisp/bindings.scm (bindings): Remove `globals' field. (global?, mark-global!, map-globals): Remove. All callers changed. * module/language/elisp/compile-tree-il.scm (generate-ensure-global, ensuring-globals): Remove. All callers changed. (global?, ensure-globals!): New procedures. (bind-lexically?): Use new `global?'. (compile-lambda, compile-let, compile-let*): Use `ensure-globals!'.
| * more lexical declarationsBT Templeton2012-02-031-0/+5
| | | | | | | | | | * module/language/elisp/boot.el (condition-case, catch): Add `lexical' declarations in macro expansions.
| * signal an error for uncaught throwsBT Templeton2012-02-031-3/+6
| | | | | | | | | | | | | | | | | | * module/language/elisp/boot.el (%catch): New variable. (catch): Bind `%catch' to `t' during the evaluation of `body'. Call `throw' instead of signalling an exception directly. (throw): Signal a `no-catch' error if there is no `catch' to throw to.
| * `catch' in terms of `condition-case'BT Templeton2012-02-031-21/+16
| | | | | | | | | | | | | | | | | | | | | | * module/language/elisp/boot.el (throw): Define an `error-conditions' property for this symbol. (catch): Define in terms of `condition-case' instead of using Guile exceptions directly. (throw): Signal a `throw' condition instead of throwing a Guile exception directly.
| * standard error symbolsBT Templeton2012-02-031-0/+6
| | | | | | | | | | | | * module/language/elisp/boot.el (error, wrong-type-argument, no-catch, invalid-function): Define `error-conditions' properties for these standard error symbols.
| * `%plist-member' fixBT Templeton2012-02-031-5/+7
| | | | | | | | | | * module/language/elisp/boot.el (%plist-member): Use recursion to avoid using `catch' and `throw'.
| * condition-caseBT Templeton2012-02-031-2/+27
| | | | | | | | | | | | | | * module/language/elisp/boot.el (signal): Accept only two arguments, and throw an `elisp-condition' exception instead of an `elisp-error' exception. (condition-case): New macro.
| * elisp `member' subrsBT Templeton2012-02-031-0/+18
| | | | | | | | | | * module/language/elisp/boot.el (%member, member, memql, memq): New functions.
| * use `dynlet' for dynamic bindingBT Templeton2012-02-031-41/+36
| | | | | | | | | | * module/language/elisp/compile-tree-il.scm (let-dynamic): Remove. All callers changed to use `dynlet' instead.
| * inline `generate-let' and `generate-let*'BT Templeton2012-02-031-97/+79
| | | | | | | | | | | | * module/language/elisp/compile-tree-il.scm (generate-let, compile-let): Inline the former into the latter. (generate-let*, compile-let*): Likewise.
| * define `flet' directlyBT Templeton2012-02-031-7/+15
| | | | | | | | | | * module/language/elisp/compile-tree-il.scm (compile-flet): Compile `flet' directly instead of using `generate-let'.
| * lexical binding macrosBT Templeton2012-02-033-28/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | * module/language/elisp/boot.el (lexical-let, lexical-let*): New macros. * module/language/elisp/compile-tree-il.scm (bind-lexically?): Remove the check for a `lexical' flag, since `lexical-let' and `lexical-let*' are no longer special operators. (compile-lexical-let, compile-lexical-let*): Remove. * module/language/elisp/runtime/function-slot.scm: Update module definition.
| * use `lexical' declarations in "boot.el"BT Templeton2012-02-031-5/+9
| | | | | | | | | | | | | | * module/language/elisp/boot.el (prog1, cond, or, catch): Use `let' with `lexical' declarations instead of `lexical-let'. (%plist-put): Use `let' instead of `lexical-let', since "boot.el" now uses lexical binding by default.
| * elisp `while' macroBT Templeton2012-02-033-50/+8
| | | | | | | | | | | | | | | | | | * module/language/elisp/compile-tree-il.scm (compile-while): Remove. * module/language/elisp/boot.el (while): New macro. * module/language/elisp/runtime/function-slot.scm: Update module definition.
| * elisp `labels'BT Templeton2012-02-032-0/+23
| | | | | | | | | | | | | | | | * module/language/elisp/compile-tree-il.scm (compile-labels): New special operator. * module/language/elisp/runtime/function-slot.scm: Update module definition.
| * fix `flet' syntaxBT Templeton2012-02-031-97/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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'.
| * elisp binding declarationsBT Templeton2012-02-031-68/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
| * declaration parsingBT Templeton2012-02-031-105/+147
| | | | | | | | | | | | | | * module/language/elisp/compile-tree-il.scm (parse-body-1, parse-body) (parse-lambda-body, parse-declaration): New procedures. (generate-let, generate-let*): Use `parse-body'. (compile-lambda): Use `parse-lambda-body'.
| * elisp lambda list parsingBT Templeton2012-02-031-171/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
| * elisp function subrsBT Templeton2012-02-035-69/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * module/language/elisp/boot.el (null, consp, listp, car, cdr) (make-symbol, signal): Use `%funcall' instead of `funcall' or `fset'. (symbolp, symbol-function, eval): Use `%funcall', since `funcall' now calls these functions. (functionp, %indirect-function): New functions. (funcall): Define in terms of `%funcall' and `%indirect-function'. (apply): New function. Previously defined in "module/language/elisp/runtime/subrs.scm". (fset): If `definition' is not a function, set the function cell of `symbol' to an falias for `definition'. * module/language/elisp/falias.scm: New file. * module/language/elisp/subrs.scm: Remove file. (apply): Remove. Now defined in "boot.el". * module/language/elisp/runtime/function-slot.scm: Update module definition. * module/Makefile.am: Update.
| * remove dynamic function bindingBT Templeton2012-02-032-22/+12
| | | | | | | | | | | | | | | | * module/language/elisp/compile-tree-il.scm (find-operator): Assume that `name' is lexically bound. * module/language/elisp/runtime.scm (symbol-fbound?, fmakunbound!): Assume that `symbol' is lexically bound. (defspecial): Bind special operators lexically.
| * elisp nil equalityBT Templeton2012-02-031-2/+14
| | | | | | | | | | | | * module/language/elisp/boot.el (eq, equal): Return `#t' if both arguments are nil. (eql): New function.
| * use lexical binding in boot.elBT Templeton2012-02-031-1/+1
| | | | | | | | * module/language/elisp/boot.el: Use lexical binding.
| * remove unused codeBT Templeton2012-02-032-32/+1
| | | | | | | | | | | | * module/language/elisp/compile-tree-il.scm (runtime-error): Remove. * module/language/elisp/runtime.scm (macro-error, runtime-error, elisp-bool, prim): Remove.
| * new elisp special form `%funcall'BT Templeton2012-02-032-0/+10
| | | | | | | | | | | | | | * module/language/elisp/compile-tree-il.scm (compile-%funcall): New procedure. * module/language/elisp/runtime/function-slot.scm: Update module definition.
| * rewrite `eval' and `load' in elispBT Templeton2012-02-032-15/+18
| | | | | | | | | | | | * module/language/elisp/subrs.scm (eval, load): Rewrite in Elisp and move to... * module/language/elisp/boot.el (eval, load): ...here.
| * evaluate the function position correctlyBT Templeton2012-02-031-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
| * purify elisp symbol cell modulesBT Templeton2012-02-032-2/+4
| | | | | | | | | | * module/language/elisp/runtime/function-slot.scm: * module/language/elisp/runtime/value-slot.scm: Define these as pure modules.
| * record elisp function namesBT Templeton2012-02-031-4/+8
| | | | | | | | | | | | | | | | | | * language/elisp/compile-tree-il.scm (compile-lambda): Add a `meta' argument for the procedure's properties. (compile-function, compile-defmacro, compile-defun): Update accordingly, passing a `name' property to `compile-lambda' where possible.
| * elisp variable aliasesBT Templeton2012-02-031-0/+8
| | | | | | | | * module/language/elisp/boot.el (defvaralias): New function.