summaryrefslogtreecommitdiff
path: root/module/language/brainfuck
AgeCommit message (Collapse)AuthorFilesLines
2020-05-08Add compiler chooser implementation; fix bugs with previous commitAndy Wingo1-1/+5
* module/system/base/compile.scm (next-pass): Invoke the language's compiler chooser if there is more than one compiler. (compute-compiler): Ensure from and to are languages. * module/system/base/language.scm (<language>): Add compiler-chooser field. * module/language/brainfuck/spec.scm (choose-compiler, brainfuck): Define a compiler chooser.
2013-12-02Fix brainfuck commentAndy Wingo1-4/+1
* module/language/brainfuck/parse.scm: Fix outdated comment.
2013-12-02Fix brainfuck->scheme compiler.Andy Wingo1-6/+3
* module/language/brainfuck/compile-scheme.scm (compile-scheme): Fix brainfuck compiler.
2011-06-02rename <application> to <call>Andy Wingo1-27/+27
* doc/ref/compiler.texi (The Scheme Compiler): Update docs. * libguile/expand.h: * libguile/expand.c: * module/language/tree-il.scm: Rename <application> to <call>. Change the external representation from (apply proc arg ...) to (call proc arg ...). * libguile/memoize.c: * module/ice-9/psyntax-pp.scm: * module/ice-9/psyntax.scm: * module/language/brainfuck/compile-tree-il.scm: * module/language/ecmascript/compile-tree-il.scm: * module/language/elisp/compile-tree-il.scm: * module/language/tree-il/analyze.scm: * module/language/tree-il/compile-glil.scm: * module/language/tree-il/fix-letrec.scm: * module/language/tree-il/inline.scm: * module/language/tree-il/primitives.scm: * test-suite/tests/tree-il.test: Update all callers.
2010-05-02remove `version' field from <language>Andy Wingo1-3/+2
* module/system/base/language.scm (<language>): Remove the `version' field from languages. It just wasn't useful. * module/language/assembly/spec.scm: * module/language/brainfuck/spec.scm: * module/language/bytecode/spec.scm: * module/language/ecmascript/spec.scm: * module/language/elisp/spec.scm: * module/language/glil/spec.scm: * module/language/objcode/spec.scm: * module/language/scheme/spec.scm: * module/language/tree-il/spec.scm: * module/language/value/spec.scm: Remove #:version from all language definitions. Shorten some language names (e.g. "Guile Scheme" -> "Scheme").
2009-11-15Revert "implement #:predicate" and remove predicate from <lambda-case>Andy Wingo1-1/+1
Turns out this was not a very useful idea, and semantically tricky to boot. This reverts commit 24bf130fd15afbc8b3a2ccdc50a027f9b6c9e623, and makes the following additional changes: * module/ice-9/optargs.scm (parse-lambda-case, let-optional) (let-optional*, let-keywords, let-keywords*): * module/language/tree-il.scm: (<lambda-case>, parse-tree-il) (unparse-tree-il, tree-il->scheme, tree-il-fold, make-tree-il-folder) (post-order!, pre-order!): * module/language/tree-il/analyze.scm (analyze-lexicals): * module/language/tree-il/compile-glil.scm (compile-glil): * module/language/tree-il/inline.scm (inline!): Remove all traces of #:predicate from tree-il. * module/ice-9/psyntax.scm (build-simple-lambda, build-lambda-case) (chi-lambda-case): Adapt to tree-il change. * module/ice-9/psyntax-pp.scm: Regenerated. * module/language/brainfuck/compile-tree-il.scm (compile-body): * module/language/ecmascript/compile-tree-il.scm (comp, comp-body): * test-suite/tests/tree-il.test: Adapt to tree-il change. * doc/ref/api-procedures.texi (Case-lambda): Remove mention of #:predicate.
2009-10-23separate "inits" field in <lambda-case>; compile fixes for inits, kwargsAndy Wingo1-1/+1
* module/language/tree-il.scm (<lambda-case>): Add "inits" field, so we don't have to parse it out of opt and kw. Adapt the traversal procedures. * module/language/tree-il/analyze.scm (analyze-lexicals): Analyze lexicals in the <lambda-case> init expressions as well. Fix keyword allocation. * module/language/tree-il/compile-glil.scm (compile-glil): Adapt to make-lambda-case change. (flatten): Adapt to "inits" slot, actually init uninitialized args, and fix bugs related to keyword arguments. * module/language/tree-il/inline.scm (inline!): Adapt a little bit -- but with no effect. * module/language/glil/compile-assembly.scm (glil->assembly): Flesh out <glil-kw-prelude> compilation some more. Add a "bound?" op for <glil-lexical>, which will push #t if the local is bound. * module/ice-9/psyntax.scm (build-simple-lambda, build-lambda-case): Update for new signature of make-lambda-case. * module/ice-9/psyntax-pp.scm: Regenerated. * module/language/brainfuck/compile-tree-il.scm (compile-body): * module/language/ecmascript/compile-tree-il.scm (comp): * test-suite/tests/tree-il.test ("lambda"): Update for new lambda-case syntax.
2009-10-23fix brainfuck for new tree-il, and add testsAndy Wingo2-11/+21
* test-suite/Makefile.am: * test-suite/tests/brainfuck.test: Add a brainfuck test. * module/system/base/compile.scm: Also export read-and-compile. * module/language/tree-il/spec.scm (join): Fix the joiner in the 0-expression case. * module/language/tree-il/primitives.scm (+): Recognize (+ x -1) as 1-. * module/language/brainfuck/parse.scm (read-brainfuck): Return EOF if we actually received EOF, and there were no expressions read. * module/language/brainfuck/compile-tree-il.scm (compile-body): Fix the compiler for the new format of "lambda" in tree-il.
2009-10-16language-readers receive environment as an argAndy Wingo1-1/+1
* module/language/assembly/spec.scm: * module/language/brainfuck/spec.scm: * module/language/bytecode/spec.scm: * module/language/ecmascript/spec.scm: * module/language/glil/spec.scm: * module/language/scheme/spec.scm: * module/language/tree-il/spec.scm: Language-readers now take two arguments: the port and the environment. This should allow for compile-environment-specific reader behavior. * module/system/base/compile.scm (read-and-compile): * module/system/repl/common.scm (repl-read): Pass the environment to the language-reader. * module/system/repl/repl.scm (meta-reader, prompting-meta-read): * module/system/repl/command.scm (define-meta-command): Use the second argument to repl-reader, so we avoid frobbing current-reader.
2009-06-24remove lambda wrap hack of brainfuck tree-il compilerAndy Wingo1-18/+5
* module/language/brainfuck/compile-tree-il.scm (compile-tree-il): Remove the hack where we wrapped the compiled code in a `lambda', because not only should the tree-il compiler optimize that away, it was really papering around other inefficiencies, and obtuse to boot.
2009-06-22more docs to brainfuck->tree-il compilerAndy Wingo1-11/+52
* module/language/brainfuck/compile-tree-il.scm (compile-tree-il): Wrap the result in a ((lambda () ...)), so we can use toplevel-ref. Add lots more comments.
2009-06-21add brainfuck->tree-il compilerAndy Wingo3-33/+181
* module/Makefile.am (BRAINFUCK_LANG_SOURCES): Compile at the end. Add compile-tree-il.scm. * module/language/brainfuck/compile-tree-il.scm: New compiler, compiles to tree-il instead of scheme. I thought it would be more illustrative, though there are some uncommented bits. * module/language/brainfuck/parse.scm: Modify not to put a header on the scheme representation. After all, we don't put <scheme> before scheme code, do we? :) * module/language/brainfuck/spec.scm: Add tree-il compiler. * module/language/tree-il.scm: Understand (set! (lexical foo) ...). * module/system/base/language.scm: Update license. Actually, updates licenses on all these.
2009-06-21formatting changes to (language brainfuck compile-scheme)Andy Wingo1-58/+57
* module/language/brainfuck/compile-scheme.scm: Standalone comments should have more than one semicolon, and update copyright to LGPLv3+.
2009-06-21added documenting comments to the brainfuck compiler and mention it in the ↵Daniel Kraft3-4/+111
VM documentation. * doc/ref/compiler.texi: Mention the new brainfuck compiler as an example. * module/language/brainfuck/compile-scheme.scm: Add a lot of documentation comments. * module/language/brainfuck/parse.scm: Ditto. * module/language/brainfuck/spec.scm: Ditto.
2009-06-21basic brainfuck -> scheme example compiler.Daniel Kraft3-0/+160
* module/Makefile.am: Install the brainfuck compiler modules. * module/language/brainfuck/spec.scm: New file. * module/language/brainfuck/parse.scm: New file. * module/language/brainfuck/compile-scheme.scm: New file.