Quote Originally Posted by paul_nicholls

I DID have a pascal version of lex and yacc lying around a while ago, but never used them - didn't understand how, and I'm not sure I would have liked trying to modify the created compilers to my own needs anyway (unlike a recursive descent parser hand-written)...
oh you do not need to rewrite Lex or Yacc. You only need to provide them with a lexic and grammar and they create a lexic and sintactic parser for you.

Creating the lexic file for Lex is quite simple. Basically you do 2 things:

- specify your tokens and give them an internal identifier
- specify the form your variable, constants and literals can take by giving Lex a regular expression.

This takes no more than 1 page of "code", believe me.

The grammar file for Yacc needs some more work since you need to make sure your grammar complies with the LALR conditions. In the university we made it for a subset of the Ada language and needed around 1 week including polishing, so for a simple grammar like yours it should not take more than 1 day.