feat: sequencing of expressions with newline to same indent (#11)
All checks were successful
continuous-integration/drone/push Build is passing
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:
parent
c4d3f66c51
commit
991976d3a8
10 changed files with 131 additions and 89 deletions
|
@ -10,28 +10,34 @@ context-free start-symbols
|
|||
|
||||
context-free sorts
|
||||
|
||||
Start Ex
|
||||
Start LineSeq Line Ex
|
||||
|
||||
context-free syntax
|
||||
|
||||
Start.TopLevel = prog:Ex {layout(offside prog)}
|
||||
Start.TopLevel = LineSeq
|
||||
|
||||
LineSeq = <<ln:Ex>> {layout(offside ln)}
|
||||
LineSeq.Sequence = sq:Ex+ {layout(align-list sq)}
|
||||
|
||||
Ex+ = Ex+ ln:Ex {layout(offside ln)}
|
||||
|
||||
Ex.Int = INT
|
||||
Ex.Stdio = <stdio>
|
||||
Ex.Sum = {Ex "+"}+
|
||||
Ex.Receives = [[Ex] << [Ex]] {left}
|
||||
Ex.Enters = [[Ex] >> [Ex]] {left}
|
||||
Ex.Stream = <stream>
|
||||
Ex.Sum = [[Ex] + [Ex]] {left}
|
||||
Ex.Gets = [[Ex] << [Ex]] {left}
|
||||
Ex.To = [[Ex] >> [Ex]] {left}
|
||||
|
||||
Ex = <(<Ex>)> {bracket}
|
||||
|
||||
context-free priorities
|
||||
|
||||
Ex.Enters
|
||||
Ex.To
|
||||
> Ex.Sum
|
||||
> Ex.Receives,
|
||||
> Ex.Gets,
|
||||
|
||||
// prevent cycle: no singletons
|
||||
Ex.Sum <0> .> {Ex "+"}+ = Ex,
|
||||
LineSeq.Sequence <0> .> Ex+ = Ex,
|
||||
|
||||
// flat: no Sum immediately in Sum:
|
||||
{Ex "+"}+ = Ex <0> .> Ex.Sum,
|
||||
{Ex "+"}+ = {Ex "+"}+ "+" Ex <2> .> Ex.Sum
|
||||
// flat: No LineSeq immediately in LineSeq
|
||||
Ex+ = Ex <0> .> LineSeq.Sequence,
|
||||
Ex+ = Ex+ Ex <1> .> LineSeq.Sequence
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue