petit parser

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

petit parser

hilaire
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: petit parser

Guillaume Larcheveque
look at PPExpressionParser class.

it's designed for that and you have a great example in the class comment

2013/1/28 Hilaire Fernandes <[hidden email]>
Hello

I try to extent the example of the arithmetic evaluator[1], I don't
understand the magic underneath nor how you will make it works with
substraction.

Changing method add to:

add
 ^ prod, ($+ asParser / $- asParser) trim, term


to parse mixture addition and substraction is wrong:

parser parse: '1 - 2 + 6'  -> #(1 $- #(2 $+ 6))


The precedence is wrong.

How will you make it work? It seems to me the way to handle precedence
in the example is not suited for extension

Thanks

Hilaire



[1] http://pharobooks.gforge.inria.fr/PharoByExampleTwo-Eng/latest/





--
Guillaume Larcheveque

Reply | Threaded
Open this post in threaded view
|

Re: petit parser

hilaire
CONTENTS DELETED
The author has deleted this message.