daut2021-po16/thrax_example.grm
Jakub Pokrywka 19c2cf1865 add thrax
2022-01-28 19:31:39 +01:00

14 lines
504 B
Plaintext

# thraxcompiler --input_grammar=thrax_example.grm --output_far=example.far
# thraxrewrite-tester --far=example.far --rules=First
#
# przykłady z https://www.cs.jhu.edu/~jason/465/hw-ofst/hw-ofst.pdf
Zero = "0";
One = "1";
Bit = Zero | One;
export First = Optimize[Zero Zero* Bit* One One One One?];
export Second = Optimize[ (Zero One (One One)* )* | (One (One One)* Zero )* | Zero* | (Zero One (One One)* Zero )* ];
export Third = Optimize["a" (("b":"x")+ | ("c"+ : "y") | ("":"fric")) "a"];