Developer of ParseKit here.
I have not looked closely at your example input to determine whether your grammar is semantically correct.
However, I do see two significant syntactical problems with your existing grammar.
First, this line contains Left Recursion (and also a syntax error with the unquoted /
):
units = unit+ | unit+ / unit+; // Incorrect. Will not work.
You must change this line to remove the Left Recursion to something like this:
units = unit ('/' unit)*;
See my prior answer for more information on eliminating Left Recursion in your ParseKit grammars.
Second, I believe this line is attempting to allow an "empty" match by using ''
:
prefix = '' | 'milli' | 'micro' | 'pico'; // Incorrect. Will not work.
That is not supported syntax in ParseKit grammars. This feature is fully supported but the syntax is Empty
, like:
prefix = Empty | 'milli' | 'micro' | 'pico';
Hope that helps.