feat: Allow expressions to be terminated/sequenced by ;
Note that ultimately a terminated sequence may have a slightly different semantics (applying streams to `_|_`, most likely) but for now they don't.
This commit is contained in:
parent
991976d3a8
commit
b9c8532899
10 changed files with 156 additions and 65 deletions
|
@ -1,10 +1,6 @@
|
|||
module javascript
|
||||
imports libstrategolib signatures/- util
|
||||
|
||||
signature
|
||||
constructors
|
||||
TopLevel: Ex -> Ex
|
||||
|
||||
rules
|
||||
js: TopLevel(x) -> $[const Stdio = {
|
||||
gets: v => { process.stdout.write(String(v)); return Stdio; },
|
||||
|
@ -15,12 +11,13 @@ rules
|
|||
}
|
||||
[x]]
|
||||
|
||||
js: Stream() -> $[Stdio]
|
||||
js: Int(x) -> 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
|
||||
js: Stream() -> $[Stdio]
|
||||
js: Int(x) -> x
|
||||
js: Sum(x,y) -> $[[x] + [y]]
|
||||
js: Gets(x, y) -> $[[x].gets([y])]
|
||||
js: To(x, y) -> $[to([x],[y])]
|
||||
js: Terminate(x) -> x
|
||||
js: Sequence(l) -> <join(|";\n")>l
|
||||
|
||||
strategies
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue