[fpc-devel] Alternative parsers

Hans-Peter Diettrich DrDiettrich1 at aol.com
Mon Oct 11 13:39:20 CEST 2010


Now I started another branch, that is not as "intrusive" as my other 
branches. The AltParser branch makes multiple parsers available, each of 
which sits in its own class derived from TParser. The parsers register 
themselves for specific file types and the compiler selects an 
applicable one, depending on the extension of the source file. The 
original parser is not affected and will be used for all file types 
without an registered parser.

For debugging purposes a compiler option (-m2) has been added, that 
selects an alternative parser, if one is registered. This allows to test 
the new parser by adding OPT=-m2 to the Make commandlines. Currently a 
message is output whenever the alternative OPL parser is used to compile 
an file.

In the first round the parser modules are cloned into the parserOPL 
unit. The original parser units will export their helper procedures, for 
use by every parser. The currently inlined semantic code will be moved 
out of the parser procedures, in multiple steps, and shall end up in its 
own unit(s). The extracted procedures shall represent logical tasks, 
that occur in every parser, e.g. dealing with declarations or common 
actions on program/module/subroutine/block begin and end.

Any comments?

DoDi




More information about the fpc-devel mailing list