2021-01-30 20:27:10 +00:00
|
|
|
module fostr
|
|
|
|
|
|
|
|
imports
|
|
|
|
|
|
|
|
Common
|
|
|
|
|
|
|
|
context-free start-symbols
|
|
|
|
|
2021-01-30 23:37:53 +00:00
|
|
|
Ex
|
2021-01-30 20:27:10 +00:00
|
|
|
|
|
|
|
context-free sorts
|
|
|
|
|
2021-01-30 23:37:53 +00:00
|
|
|
Ex
|
2021-01-30 20:27:10 +00:00
|
|
|
|
|
|
|
context-free syntax
|
|
|
|
|
2021-01-30 23:37:53 +00:00
|
|
|
Ex.Int = INT
|
|
|
|
Ex.Stdio = <stdio>
|
|
|
|
Ex.Sum = {Ex "+"}+
|
|
|
|
Ex.Receives = [[Ex] << [Ex]] {left}
|
2021-02-01 00:44:45 +00:00
|
|
|
Ex.Enters = [[Ex] >> [Ex]] {left}
|
|
|
|
Ex = <(<Ex>)> {bracket}
|
2021-01-30 23:37:53 +00:00
|
|
|
|
|
|
|
context-free priorities
|
|
|
|
|
2021-02-01 00:44:45 +00:00
|
|
|
Ex.Enters
|
|
|
|
> Ex.Sum
|
2021-01-30 23:37:53 +00:00
|
|
|
> 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
|