[Lazarus] Using FPC parser/tokenizer for code formatting
Florian Klaempfl
florian at freepascal.org
Sat May 29 10:16:40 CEST 2010
Hans-Peter Diettrich schrieb:
> Michael Van Canneyt schrieb:
>
>> Using the parser/scanner from the compiler is an impossible task,
>> they are impossible to separate.
>
> There's nothing impossible in software ;-)
Yes, but within a reasonable time and without other penalties :)
>
> It's a matter of refactoring, and whether the refactored code will be
> accepted by the FPC team.
If it's good I'am sure it will be accepted, but I expect this to be a
work of years.
> First expected rejection argument: it slows
> down compilation...
>
> A weak argument so far, perhaps we can make the parser even faster?
I doubt this, just one example: ptconst.pas: it parses typed constants.
Due being tailored for the compiler, it reads the constants and writes
them without any second pass to the output assembler list. A generic
parser needs to create first some kind of parse tree and this parse tree
needs to be outputted in a second pass. One does so and we release a
compiler with this and then the people pop up, crying that their pascal
files with millions of lines of typed constants don't compile anymore or
compiles for ages because memory requirements of the compiler heavily
increased.
More information about the Lazarus
mailing list