Jparsec is now ported to Ruby, with a way lighter syntax than Java.
The following is the ruby version of calculator:
As easy as that!
The above example directly calculates the result. What if we want to construct abstract syntax tree instead?
The first step is of course to create the abstract syntax tree classes. For example:
rparsec can be downloaded at http://rubyforge.org/frs/?group_id=2326
API document is available online
Created by benyu benyu
On Sun Oct 08 14:53:56 CDT 2006