forked from glen/fostr
33 lines
463 B
Plaintext
33 lines
463 B
Plaintext
module fostr
|
|
|
|
imports
|
|
|
|
Common
|
|
|
|
context-free start-symbols
|
|
|
|
Ex
|
|
|
|
context-free sorts
|
|
|
|
Ex
|
|
|
|
context-free syntax
|
|
|
|
Ex.Int = INT
|
|
Ex.Stdio = <stdio>
|
|
Ex.Sum = {Ex "+"}+
|
|
Ex.Receives = [[Ex] << [Ex]] {left}
|
|
|
|
context-free priorities
|
|
|
|
Ex.Sum
|
|
> Ex.Receives,
|
|
|
|
// prevent cycle: no singletons
|
|
Ex.Sum <0> .> {Ex "+"}+ = Ex,
|
|
|
|
// flat: no Sum immediately in Sum:
|
|
{Ex "+"}+ = Ex <0> .> Ex.Sum,
|
|
{Ex "+"}+ = {Ex "+"}+ "+" Ex <2> .> Ex.Sum
|