forked from glen/fostr
Add OCaml code generation (#24)
Also start using nailgun to speed up code generation. Resolves #6. Co-authored-by: Glen Whitney <glen@studioinfinity.org> Reviewed-on: glen/fostr#24 Co-Authored-By: Glen Whitney <glen@nobody@nowhere.net> Co-Committed-By: Glen Whitney <glen@nobody@nowhere.net>
This commit is contained in:
parent
380177b274
commit
cc89ad1e93
11 changed files with 155 additions and 8 deletions
|
@ -59,8 +59,8 @@ For example, this snippet generates the following Python:
|
|||
It generates nearly identical code in
|
||||
this simple example for Javascript (just with `"Hello, world!"`
|
||||
in place of `r'Hello, world!'`), although it generates a different
|
||||
preamble defining Stdio for each language. (Currently, Haskell code
|
||||
generation is also supported.)
|
||||
preamble defining Stdio for each language. (Currently, Haskell and OCaml
|
||||
code generation are also supported.)
|
||||
|
||||
There's not much to break down in such a tiny program as this, but let's do
|
||||
it. The prefix operator `<<<` could be read as "the default stream receives...",
|
||||
|
@ -108,7 +108,7 @@ again. That way we can use the general (left-associative)
|
|||
parse to TopLevel(
|
||||
Gets(Gets(Gets(Gets(DefGets(LitString("'Two and '")),Int("2")),
|
||||
LitString("' make '")),Sum(Int("2"),Int("2"))),
|
||||
EscString("\"./n\"")))
|
||||
EscString("\".\n\"")))
|
||||
/** writes
|
||||
Two and 2 make 4.
|
||||
**/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue