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
|
@ -10,16 +10,24 @@ context-free start-symbols
|
|||
|
||||
context-free sorts
|
||||
|
||||
Start LineSeq Line Ex
|
||||
Start LineSeq Line OptTermEx TermExLst TermEx Ex
|
||||
|
||||
context-free syntax
|
||||
|
||||
Start.TopLevel = LineSeq
|
||||
|
||||
LineSeq = <<ln:Ex>> {layout(offside ln)}
|
||||
LineSeq.Sequence = sq:Ex+ {layout(align-list sq)}
|
||||
LineSeq = Line
|
||||
LineSeq.Sequence = sq:Line+ {layout(align-list sq)}
|
||||
|
||||
Ex+ = Ex+ ln:Ex {layout(offside ln)}
|
||||
Line = OptTermEx
|
||||
Line.ISequence = TermExLst OptTermEx {layout(0.first.line == 1.first.line)}
|
||||
|
||||
TermExLst.Prior = TermEx+
|
||||
|
||||
OptTermEx = ex:Ex {layout(offside ex)}
|
||||
OptTermEx = te:TermEx {layout(offside te)}
|
||||
|
||||
TermEx.Terminate = <<Ex>;>
|
||||
|
||||
Ex.Int = INT
|
||||
Ex.Stream = <stream>
|
||||
|
@ -36,8 +44,4 @@ context-free priorities
|
|||
> Ex.Gets,
|
||||
|
||||
// prevent cycle: no singletons
|
||||
LineSeq.Sequence <0> .> Ex+ = Ex,
|
||||
|
||||
// flat: No LineSeq immediately in LineSeq
|
||||
Ex+ = Ex <0> .> LineSeq.Sequence,
|
||||
Ex+ = Ex+ Ex <1> .> LineSeq.Sequence
|
||||
LineSeq.Sequence <0> .> Line+ = Line
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue