module fostr imports Common context-free start-symbols Start context-free sorts Start LineSeq Line Ex context-free syntax Start.TopLevel = LineSeq LineSeq = <> {layout(offside ln)} LineSeq.Sequence = sq:Ex+ {layout(align-list sq)} Ex+ = Ex+ ln:Ex {layout(offside ln)} Ex.Int = INT Ex.Stream = Ex.Sum = [[Ex] + [Ex]] {left} Ex.Gets = [[Ex] << [Ex]] {left} Ex.To = [[Ex] >> [Ex]] {left} Ex = <()> {bracket} context-free priorities Ex.To > Ex.Sum > 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