feat: sequencing of expressions with newline to same indent (#11)
All checks were successful
continuous-integration/drone/push Build is passing

feat: sequencing of expressions with newline to same indent

  Also revised README to reflect greater emphasis on streams.
  Haskell code generation unsurprisingly required a fairly significant
  rework.

  Resolves #3.

Co-authored-by: Glen Whitney <glen@studioinfinity.org>
Reviewed-on: #11
Co-Authored-By: Glen Whitney <glen@nobody@nowhere.net>
Co-Committed-By: Glen Whitney <glen@nobody@nowhere.net>
This commit is contained in:
Glen Whitney 2021-02-06 05:11:41 +00:00
parent c4d3f66c51
commit 991976d3a8
10 changed files with 131 additions and 89 deletions

View file

@ -7,25 +7,24 @@ signature
rules
js: TopLevel(x) -> $[const Stdio = {
receives: v => { process.stdout.write(String(v)); return Stdio; },
gets: v => { process.stdout.write(String(v)); return Stdio; },
}
function forwards(data, strm) {
strm.receives(data);
function to(data, strm) {
strm.gets(data);
return data;
}
[x]]
js: Stdio() -> $[Stdio]
js: Stream() -> $[Stdio]
js: Int(x) -> x
js: Sum(x) -> $[[x].reduce((v,w) => v+w)]
js: Receives(x, y) -> $[[x].receives([y])]
js: Enters(x, y) -> $[forwards([x],[y])]
jslist: x -> $<[<<join(|", ")>x>]>
js: Sum(x,y) -> $[[x] + [y]]
js: Gets(x, y) -> $[[x].gets([y])]
js: To(x, y) -> $[to([x],[y])]
js: Sequence(l) -> <join(|";\n")>l
strategies
javascript = bottomup(try(js <+ jslist))
javascript = bottomup(try(js))
// Interface javascript code generation with editor services and file system
to-javascript: (selected, _, _, path, project-path) -> (filename, result)