[Lazarus] Using FPC parser/tokenizer for code formatting

Adem listmember at letterboxes.org
Mon May 31 14:40:34 CEST 2010


On 2010-05-31 15:28, Florian Klaempfl wrote:
> Adem schrieb:
>    
>> On 2010-05-31 14:57, Florian Klaempfl wrote:
>>      
>>>> But, the parser does produce a parse tree, doesn't it.
>>>>          
>>> FPC doesn't produce a parse tree during compilation. The parser puts
>>> declarations/definitions immediatly into the symtables, for code an
>>> intermediate representation is created which is indeed a tree but no
>>> more a parse tree because statements might already be transformed.
>>>
>>>        
>> So, if I understand this right, the code is parsed but instead of
>> producing a tree, a more directly usable structure is created.
>>
>> Now, the question is, can it be made to produce (in parallel with what
>> it already does) a tree to be used elsewhere?
>>      
> Of course this could be done but we are now at the point were the
> discussion started: if somebody adds new features and doesn't update
> this alternate path/code to produce this tree, the situation is the same
> as currently.
>    
True. In order to avoid this sort of thing all together, the best 
solution would be making the compiler use a parse tree.

But, failing that, adding/altering the needed code in the parser still 
looks like a lot easier (less effort) than doing it with a completely 
separate parser.

-- 
Cheers,

Adem





More information about the Lazarus mailing list