djfz-2021/thrax_example.grm

14 lines
504 B
Plaintext
Raw Normal View History

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