Glen Whitney
7feddbcfbe
All checks were successful
continuous-integration/drone/push Build is passing
Add the ! postfix operator and !! expression. Also add the ++ string concatenation operator. Also allow specification of standard input in the test scheme. Resolves #7, #18. Co-authored-by: Glen Whitney <glen@studioinfinity.org> Reviewed-on: #25 Co-Authored-By: Glen Whitney <glen@nobody@nowhere.net> Co-Committed-By: Glen Whitney <glen@nobody@nowhere.net>
25 lines
892 B
Plaintext
25 lines
892 B
Plaintext
module desugar
|
|
imports libstrategolib signatures/-
|
|
|
|
rules
|
|
/* ISequence() and Prior() are just noise for more expressions in sequence,
|
|
put in to get the layout rules right. So we remove them and collapse
|
|
all occurrence of them into one big Sequence() call on a list.
|
|
|
|
This is slightly tricky because there might not be any Sequence() call
|
|
at the top level, but yet an ISequence(). So we do it in two passes,
|
|
first converting ISequence()s to Sequence()s, and then collapsing
|
|
Sequence()s.
|
|
*/
|
|
deISe: ISequence(Prior(l),x) -> Sequence(<conc>(l, [x]))
|
|
|
|
seqFlatten: Sequence(l) -> Sequence(<mapconcat(?Sequence(<id>) <+ ![<id>])>l)
|
|
|
|
defStream: DefGets(x) -> Gets(Stream(), x)
|
|
defStream: DefTo(x) -> To(x, Stream())
|
|
defStream: DefEmits() -> Emits(Stream())
|
|
|
|
strategies
|
|
|
|
desugar-fostr = bottomup(try(defStream <+ deISe <+ seqFlatten))
|