summaryrefslogtreecommitdiff
path: root/module/language
AgeCommit message (Collapse)AuthorFilesLines
2012-02-03new elisp special form `%funcall'BT Templeton2-0/+10
* module/language/elisp/compile-tree-il.scm (compile-%funcall): New procedure. * module/language/elisp/runtime/function-slot.scm: Update module definition.
2012-02-03rewrite `eval' and `load' in elispBT Templeton2-15/+18
* module/language/elisp/subrs.scm (eval, load): Rewrite in Elisp and move to... * module/language/elisp/boot.el (eval, load): ...here.
2012-02-03evaluate the function position correctlyBT Templeton1-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.
2012-02-03purify elisp symbol cell modulesBT Templeton2-2/+4
* module/language/elisp/runtime/function-slot.scm: * module/language/elisp/runtime/value-slot.scm: Define these as pure modules.
2012-02-03record elisp function namesBT Templeton1-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.
2012-02-03elisp variable aliasesBT Templeton1-0/+8
* module/language/elisp/boot.el (defvaralias): New function.
2012-02-03simplify elisp symbol accessorsBT Templeton4-99/+92
* module/language/elisp/boot.el (fset, symbol-value, symbol-function) (set, makunbound, fmakunbound, boundp, fboundp): Use procedures in `(language elisp runtime)'. (symbolp): New function. * module/language/elisp/compile-tree-il.scm (set-variable!): Use `set-symbol-function!'. * module/language/elisp/runtime.scm (reference-variable, set-variable!): Remove. (symbol-fluid, set-symbol-fluid!): New procedure. (symbol-value, set-symbol-value!, symbol-function) (set-symbol-function!, symbol-bound?, symbol-fbound?, makunbound!) (fmakunbound!): Moved from `(language elisp subrs)' and updated to avoid using `reference-variable' and `set-variable!'. * module/language/elisp/runtime/subrs.scm (symbol-value) (symbol-function, set, fset, makunbound, fmakunbound, boundp) (fboundp): Move to `(language elisp runtime)'. (apply): Use `symbol-function'.
2012-02-03elisp property listsBT Templeton1-0/+47
* module/language/elisp/boot.el (%plist-member, %plist-get, %plist-put) (plist-get, plist-put, plist-member, lax-plist-get, lax-plist-put) (symbol-plist, setplist, get, put): New functions. (plist-function): New variable.
2012-02-03simplify `mark-global!'BT Templeton1-3/+1
* module/language/elisp/bindings.scm (mark-global!): Use `lset-adjoin'.
2012-02-03remove `flet*' elisp special formBT Templeton2-9/+1
* 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-03remove `with-always-lexical' elisp special formBT Templeton2-51/+5
* 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-03emacs-compatible lexical bindingBT Templeton5-9/+46
* 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-03remove `bind-arg-lexical?'BT Templeton1-7/+2
* module/language/elisp/compile-tree-il.scm (bind-arg-lexical?): Remove. All callers changed to use `bind-lexically?'.
2012-02-03fix elisp `catch'BT Templeton1-4/+4
* module/language/elisp/boot.el (catch): Only catch exceptions of type `elisp-exception'.
2012-02-03implement `throw' in elispBT Templeton2-7/+3
* module/language/elisp/runtime/subrs.scm (throw): Rewrite in Elisp and move to... * module/language/elisp/boot.el (throw): ...here.
2012-02-03rewrite `map-globals'BT Templeton1-16/+8
* module/language/elisp/bindings.scm (map-globals): Use `append-map' and `map' instead of explicit iteration with named `let'.
2012-02-03use srfi-9 for elisp bindings recordsBT Templeton2-50/+47
* module/language/elisp/bindings.scm: Use `(srfi srfi-9)'. (bindings-type): Remove low-level record type definition and replace with... (bindings): ...this, an SRFI-9 record type. All uses changed. (mark-global-needed!): Rename to... (mark-global!): ...this. All callers changed. (map-globals-needed): Rename to... (map-globals): ...this. All callers changed.
2012-02-03fix compilation of elisp forms with empty bodiesBT Templeton1-14/+9
* 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-03rewrite elisp macros in elispBT Templeton4-196/+93
* module/language/elisp/runtime/macros.scm: Remove. (macro-lambda, macro-prog1, macro-prog2, macro-cond, macro-and, macro-or, macro-catch, macro-unwind-protect): Rewrite in Elisp and move to... * module/language/elisp/boot.el (lambda, prog1, prog2, cond, and, or, catch, unwind-protect): ...here. (eval-and-compile): New macro. (funcall, fset, null, consp, listp, car, cdr, make-symbol-signal): Wrap definitions in an `eval-and-compile' form so that they can be used by the rewritten macros. * module/language/elisp/runtime.scm: Remove `built-in-macro'. * module/language/elisp/Makefile.am: Remove module/language/elisp/runtime/macros.scm from `ELISP_LANG_SOURCES'.
2012-02-03new elisp special form `eval-when-compile'BT Templeton2-0/+6
* module/language/elisp/compile-tree-il.scm (compile-eval-when-compile): New function. * module/language/elisp/runtime/function-slot.scm: Update module definition.
2012-02-03remove unnecessary elisp macrosBT Templeton2-78/+2
* 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-03new `string' and `mapcar' elisp subrsBT Templeton1-0/+9
* module/language/elisp/boot.el (string, mapcar): New functions.
2012-02-03rewrite elisp subrs in elispBT Templeton4-372/+242
* module/language/elisp/runtime/subrs.scm (%, *, +, -, /=, 1+, 1-, <) (<=, =, >, >=, abs, append, atom, car, car-safe, cdr, cdr-safe, cons) (consp, eq, equal, fceiling, ffloor, float, floatp, fround, ftruncate) (funcall, integerp, length, list, listp, make-list, max, min, nlistp) (nth, nthcdr, null, numberp, reverse, setcar, setcdr, wholenump) (zerop): Rewrite in Elisp and move to... * module/language/elisp/boot.el: ...here. Some functions have stricter type checking, and `elisp-bool' is not currently used (so some predicate functions now return `#f' instead of `#nil'). (boundp, eval, fboundp, fmakunbound, fset, load, makunbound, set) (symbol-function, symbol-value, throw): New functions; they call their existing implementations in subrs.scm. (@): New macro. * module/language/elisp/runtime.scm (built-in-func): Remove. All uses changed. * module/language/elisp/runtime/function-slot.scm: Update module definition.
2012-02-03remove unnecessary elisp subrsBT Templeton1-36/+0
* 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`atomp' -> `atom'BT Templeton1-1/+1
* module/language/elisp/runtime/subrs.scm (atomp) Rename to... (atom): ...this. All callers changed.
2012-02-03use `nil?' for elisp conditionalsBT Templeton1-8/+10
* module/language/elisp/compile-tree-il.scm (compile-if): Use the `nil?' primitive for conditionals.
2012-02-03add `nil?' primitiveBT Templeton4-1/+17
* libguile/boolean.c (scm_nil_p): New function. * libguile/vm-i-scheme.c (nilp, not_nilp): * libguile/vm-i-system.c (br_if_nil, br_if_not_nil): New instructions. Renumber other ops. * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Increment. * module/language/assembly/compile-bytecode.scm (compile-bytecode): Add support for writing `br-if-nil' and `br-if-not-nil' instructions. * module/language/assembly/disassemble.scm (code-annotation): Add `br-if-nil' and `br-if-not-nil' to the list of branch instructions. * module/language/tree-il/compile-glil.scm: Add `nil?' to `*primcall-ops*'. (flatten): Use the new branch instructions for `nil?' conditionals. * module/language/tree-il/primitives.scm: Add `nil?' to `*interesting-primitive-names*', `*effect-free-primitives', and `*effect+exception-free-primitives*'.
2012-02-03Augment `-Wformat' analysis with support for `~:h'.Ludovic Courtès1-1/+7
* module/language/tree-il/analyze.scm (format-string-argument-count): Add support for ~h. * test-suite/tests/tree-il.test ("warnings")["format"]("~h", "~:h with locale object", "~:h without locale object"): New tests.
2012-01-30Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo4-9/+57
Conflicts: libguile/debug.h module/ice-9/psyntax-pp.scm module/ice-9/psyntax.scm module/language/tree-il/peval.scm module/language/tree-il/primitives.scm
2012-01-30Merge commit '3d51e57cfb0404db568a6adfde2a346d3fd9907e'Andy Wingo3-6/+10
Conflicts: libguile/foreign.c libguile/hashtab.c module/ice-9/psyntax-pp.scm module/language/tree-il/compile-glil.scm
2012-01-30Merge commit '9b0975f1dc41ddd10d81fb5b0965b9e9a54ef37a'Andy Wingo1-2/+11
Conflicts: libguile/foreign.c module/ice-9/psyntax-pp.scm module/ice-9/psyntax.scm
2012-01-26more readable gensymsAndy Wingo2-11/+11
* module/language/tree-il/peval.scm (peval): * module/language/tree-il/primitives.scm (dynamic-wind): When you make a gensym that just has to be compared against other gensyms, it will be unique if the prefix doesn't end in something that can be interpreted as a number. There's no reason to make that character something difficult like " ". So change to use a dash in that case. * module/ice-9/psyntax-pp.scm: Regenerate. More readable now.
2012-01-26Fix typo in `-Wformat'.Ludovic Courtès1-1/+1
* module/language/tree-il/analyze.scm (format-analysis): Call `warning', not `warn'.
2012-01-26Add warnings for unsupported `simple-format' options.Ludovic Courtès2-4/+52
* module/language/tree-il/analyze.scm (format-analysis)[check-simple-format-args]: New procedure. Use it. Add support for applications of <module-ref>. * module/system/base/message.scm (%warning-types): Handle the `format simple-format' warning. * module/language/scheme/spec.scm (scheme)[make-default-environment]: Use `simple-format' as the default `format'. * test-suite/tests/tree-il.test ("warnings")["format"]: Explicitly use (@ (ice-9 format) format) where needed. ("simple-format"): New test prefix.
2012-01-25better function prologue disassemblyAndy Wingo1-1/+4
* module/language/assembly/disassemble.scm (code-annotation): Add an annotation for assert-nargs-ee/locals and assert-nargs-ge/locals.
2012-01-25add another case in which to fold (values FOO) to FOO, for some FOOAndy Wingo1-2/+4
* module/language/tree-il/peval.scm (peval): Fold (values 'singly-valued-expression) to 'singly-valued-expression in contexts that expect multiple values, in addition to those that expect single values.
2012-01-25fix values miscompilation in push context with RAAndy Wingo1-4/+3
* module/language/tree-il/compile-glil.scm (flatten-lambda-case): Fix miscompilation of `values' in a push context with RA. * test-suite/tests/tree-il.test: Add low-level test for this miscompilation.
2012-01-14Don't diverge when serializing cyclic lists during compilationMark H Weaver1-3/+5
* module/language/glil/compile-assembly.scm (scheme-list?): Don't diverge when serializing cyclic lists.
2012-01-14Fix serialization of #nil-terminated lists during compilationMark H Weaver1-2/+9
* module/language/glil/compile-assembly.scm (scheme-list?): New predicate, like `list?' but requires that the last cdr must be '(), not #nil. (dump-object, dump-constants): Use `list' opcode to create a list only if it is terminated by '(). If it's terminated by #nil, we must use the more general `cons' opcode.
2012-01-10Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo2-2/+2
Conflicts: libguile/__scm.h libguile/array-map.c libguile/procprop.c libguile/tags.h module/ice-9/deprecated.scm module/ice-9/psyntax-pp.scm module/ice-9/psyntax.scm test-suite/standalone/test-num2integral.c test-suite/tests/regexp.test
2012-01-10Merge commit 'f78a1ccede02ccad89d6c91a6b297f1f14a30907'Andy Wingo1-1/+2
2012-01-10Merge commit 'cc8afa2b361635953dfba7f10e4193b1f243a50f'Andy Wingo1-2/+2
Conflicts: module/ice-9/psyntax-pp.scm module/language/tree-il/peval.scm
2012-01-05Placate a number of `syntax-check' verifications.Ludovic Courtès2-2/+2
- "filesystem" -> "file system" - remove doubled words - use EXIT_* macros instead of literal numbers - update `syntax-check' exclusion files
2011-12-30Fix comment summarizing allocation tableMark H Weaver1-1/+2
* module/language/tree-il/analyze.scm (analyze-lexicals): Fix comment, which describes the compiler's allocation table, to match reality.
2011-12-21peval fix: (cons 1 #nil) is not (list 1)Andy Wingo1-1/+1
* module/language/tree-il/peval.scm (peval): (cons FOO #nil) is not (cons FOO '()). * test-suite/tests/tree-il.test ("partial evaluation"): Add a test.
2011-12-21peval minor tweakAndy Wingo1-1/+1
* module/language/tree-il/peval.scm (peval): Record residual values in both value and values contexts. No test cases, it just seemed like a good idea.
2011-12-19Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-66/+73
Conflicts: libguile/feature.c m4/gnulib-cache.m4 module/ice-9/deprecated.scm module/language/tree-il/peval.scm
2011-12-19fix peval to preserve effects when folding (values) formsAndy Wingo1-67/+77
* module/language/tree-il/peval.scm (singly-valued-expression?): New helper. (truncate-values): Use the helper. (make-operand): Minor refactor. (set-operand-residual-value!): Try to undo the effects of (values FOO), if the continuation will check itself for the correct number of values. (peval): Fold helpers into fold-constant. Add a constant-expression? case for (values FOO). Add a new context: "values", for contexts in which multiple values are allowed, either because of being in a tail context relative to a function, or because of let-values. "value" is now for single values. Don't visit operands for "values", as their binding form truncates to one value. Add a case to fold (values ...) forms. Fix folding of (lambda), to process the cases in values context instead of tail context (which could have been "value", which would cause the procedure to truncate).
2011-12-13Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-1/+44
Conflicts: configure.ac
2011-12-06peval: Truncate multiple values when extending the environment.Ludovic Courtès1-1/+44
Reported by Cédric Cellier <rixed@happyleptic.org>. * module/language/tree-il/peval.scm (truncate-values): New procedure. (make-operand): Call `truncate-values' SOURCE. * test-suite/tests/tree-il.test ("partial evaluation"): New tests for multiple value truncation.