[colm-users] new way of constructing trees

Adrian Thurston thurston at complang.org
Thu Sep 10 01:28:39 UTC 2009


Like reparse in TXL, except you don't have to give it all the text at 
once. You can can give it bit-by-bit.

The syntax might not be right. I'm currently using the same syntax as 
for match and construct (literals in "). Both of these have a type 
associated with them and are parsed at compile-time. This does not have 
a type, instead it's just like text that gets parsed at run-time. That's 
one syntax, two meanings. Not the greatest.

I'm thinking maybe use backticks instead to specify text with embedded 
variables.

Output <<
	`void f( int i, [SomeType] j );`

-Adrian

Jim Cordy wrote:
> Cool, I think - not sure that I understand!
> 
> Jim
> 
> 
> On 9-Sep-09, at 7:54 PM, Adrian Thurston wrote:
> 
>> Hi,
>>
>> I'm experimenting with a new way in Colm to make trees. The existing
>> construct expression is useful for building trees in a bottom up
>> fashion. It is parsed at compile-time to give some static assurance of
>> success.
>>
>> The existing parse expression can be used to parse from a stream  
>> source,
>> or reparse the text of a tree as a new type. The parsing happens at
>> run-time and may fail.
>>
>> A new third method, the accumulator, can be used to incrementally  
>> build
>> a tree by parsing little bits at a time. This is useful for building  
>> an
>> output tree over the course of a top-down, left-right traversal.
>>
>> See here for a simple example:
>>
>> http://svn.complang.org/colm/trunk/test/accum.lm
>> http://svn.complang.org/colm/trunk/test/accum.in
>>
>> -Adrian
>>
>>
>> _______________________________________________
>> colm-users mailing list
>> colm-users at complang.org
>> http://www.complang.org/mailman/listinfo/colm-users
> 
> 
> _______________________________________________
> colm-users mailing list
> colm-users at complang.org
> http://www.complang.org/mailman/listinfo/colm-users




More information about the colm-users mailing list