I’m writing an emulator for an old computer. It used a BASIC dialect, which is straight forward to implement, with one exception:
Variable names can consist of 1 or 2 letters (second character can also be a digit). Now, there’s a command, which uses single letters to make parameters in a comma-separated list more human-readable; like this
DLOAD <filename>, D<ln>, U<un>
The letters ‘D’ and ‘U’ must literally preceed the parameters and (which are integers), with or without space between the letter and the parameter.
Now I can’t find a way to realize that with PLY, as e.g. ‘D8’ is also a valid variable name.
Is there a way, to successfully parse such a grammar with PLY?
Thanks for any help!