3 ms·
Hi! So right now, I can write the grammar G1 for a language L1 in Ohm and parse strings written in L1 by putting them in examples. If L1 is a language for des
by asrp 10y ago
Hi!
So right now, I can write the grammar G1 for a language L1 in Ohm and parse strings written in L1 by putting them in examples.
If L1 is a language for describing grammars (such as a Ohm with a slightly different syntax), one of the "example" could be the grammar G2 for a language L2. But then I can't give the editor examples of L2 to be parsed!
(Of course if L1 has extra semantics instead of just syntax, it wouldn't be easy to change anyway, except by editing the Ohm Editor's source.)
A sample use case:
G2 is something like this:
https://github.com/asrp/pymetaterp/blob/master/pymetaterp/boot_grammar.py https://github.com/asrp/pymetaterp/blob/master/pymetaterp/bo...
The example/input written in L2 that I want to give it is something like this
https://github.com/asrp/pymetaterp/blob/master/pymetaterp/python_grammar.py https://github.com/asrp/pymetaterp/blob/master/pymetaterp/py...
I could of course, rewrite this input in Ohm's grammar just so I can visualize the parse in the Ohm editor but it would be faster if I only needed to write G1 (that is, G2 translated to Ohm but matching the same language as L2=L1) and make minor adjustments to the input.
A full translation of this "input" to Ohm would also make it harder for me to port bugs fixed in the Ohm version back to the original version.
The next step would be to make this input the grammar G3 and give it inputs which can be visualized in the editor.
I'm not sure if you intend to have the Ohm editor used like this or not though.
Very nice project, by the way. I really like how you show the parts of the inputs that matches, with the option of expanding rules.