开发者

Using Parsekit to construct parse tree

开发者 https://www.devze.com 2023-03-25 05:35 出处:网络
I\'m using Parsekit for XCode but this problem may well apply to most parser generators. I parse a script with a gammer and it works fine. However I\'m running into problems with the next step. Consid

I'm using Parsekit for XCode but this problem may well apply to most parser generators. I parse a script with a gammer and it works fine. However I'm running into problems with the next step. Consider the grmmer:

@start = line+; line = tree;

tree = 'tree' fruits branches;

fruits = 'with' 'fruits' Number; branches = 'with' 'branches' Number;

And 开发者_如何学JAVAthe script to pass:

tree with fruits 8 with branches 12

If I then implemenet methods to match, fruits and branches will be matched once, this is expected.

However tree will be matched twice, why? This stops me from building the parse tree I want.

Thanks for any help!


Developer of ParseKit here. I think you might actually be asking the same question as this:

parsekit given unexpected calls to selectors

If you read through the comments I made on that question, I think you will find the answer. Let me know if not.

0

精彩评论

暂无评论...
验证码 换一张
取 消