2021-02-10 20:47:34 +00:00
|
|
|
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]))
|
|
|
|
|
2021-02-10 21:07:51 +00:00
|
|
|
seqFlatten: Sequence(l) -> Sequence(<mapconcat(?Sequence(<id>) <+ ![<id>])>l)
|
2021-02-10 20:47:34 +00:00
|
|
|
|
2021-02-18 20:18:47 +00:00
|
|
|
defStream: DefGets(x) -> Gets(Stream(), x)
|
|
|
|
defStream: DefTo(x) -> To(x, Stream())
|
2021-03-02 04:51:12 +00:00
|
|
|
defStream: DefEmits() -> Emits(Stream())
|
2021-02-18 20:18:47 +00:00
|
|
|
|
2021-02-10 20:47:34 +00:00
|
|
|
strategies
|
|
|
|
|
2021-02-18 20:18:47 +00:00
|
|
|
desugar-fostr = bottomup(try(defStream <+ deISe <+ seqFlatten))
|