From: Matt Wette <matthew.wette@verizon.net>
To: guile-user@gnu.org
Subject: Q on (language <lang> spec)
Date: Sat, 17 Oct 2015 12:02:53 -0700 [thread overview]
Message-ID: <A2822758-688C-404C-BE8C-1858FB4747BD@verizon.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 2272 bytes --]
I am playing with the compiler tower and have been digging through the (system base language) module to try to get my hands around writing to the compiler tower. Here is the define-language signature:
define-language
[#:name] [#:title] [#:reader] [#:printer]
[#:parser=#f] [#:compilers='()]
[#:decompilers='()] [#:evaluator=#f]
[#:joiner=#f] [#:for-humans?=#t]
[#:make-default-environment=make-fresh-user-module]
Here are my assumptions. I’d appreciate corrections if I have missed something.
reader is a procedure that must be provided. The procedure takes input port and environment and returns a form of the implementers choice. The text read from the input port is (nominally) in the supported language.
parser is an optional procedure. If provided, it takes the output form generated by the reader and returns another form in the implementors choice.
compilers is an a-list of (symbol . procedure). For each symbol the associated procedure takes as input the form produced by the parser or reader (for the case where parser is not provided) and generates the code associated with the symbol. For example, if no parser is defined, an entry of `(tree-il . ,compile-tree-il) means the implementer provides a procedure compile-tree-il that takes a form (returned by the reader), an environment form, and an options (a-list?) and generates tree-il.
decompilers is an a-list of (symbol . procedure). The procedure takes an expression in the symbol-designated form, along with environment and option a-list, and returns something in the implementers intermediate form (output of parser, or of reader in case no parser is specified).
What did I miss or get wrong? I have not been digging to figure out joiner or evaluator yet.
I have been able to do the following, but not sure I’ve got things laid out correctly yet:
scheme@(guile-user)> ,L javascript
Happy hacking with javascript! To switch back, type `,L scheme'.
javascript@(guile-user)> var abc = 123
javascript@(guile-user)> ,L scheme
Happy hacking with Scheme! To switch back, type `,L javascript'.
scheme@(guile-user)> abc
$1 = 123
Matt
[-- Attachment #2: Type: text/html, Size: 4360 bytes --]
next reply other threads:[~2015-10-17 19:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-17 19:02 Matt Wette [this message]
2015-10-18 20:00 ` Q on (language <lang> spec) Matt Wette
2015-10-19 3:53 ` Nala Ginrut
2015-10-23 0:20 ` Matt Wette
2015-10-23 13:10 ` Matt Wette
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=A2822758-688C-404C-BE8C-1858FB4747BD@verizon.net \
--to=matthew.wette@verizon.net \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).