parsekit icon indicating copy to clipboard operation
parsekit copied to clipboard

PKTreeAssembler

Open mhakman opened this issue 12 years ago • 1 comments

I'm trying to use your PKTreeAssembler. Yes, I know it is in the test package, not in the framework but I still need it. It is sufficiently complex so I refrain from writing one myself. I have it working (after few changes for ARC) but the returned PKParseTree contains only rule nodes and no tokens at all. I have tried to debug it - it seems OK. It seems to add PKToken nodes to the tree. Somehow they disappear from the returned tree. What could be wrong? Thanks.

/Mikael

mhakman avatar Oct 11 '13 17:10 mhakman

I did some more research. It seems that I get or not the terminal tokens depending on the grammar. Following grammar works OK:

@start = stmts;
 stmts = stmt+;     
 stmt  = expr ';';  
 expr  = Word+;

But not this one:

@start = stmt+;
 stmt  = expr ';';  
 expr  = Word+;

Perhaps one has to have only one simple rule name in the @start directive.

Thanks/Mikael

mhakman avatar Oct 12 '13 14:10 mhakman