2010-09-23 10:19, Mingli Yuan skrev:
Yes, Andreas,
I tried to install it on my local ubuntu, but failed at the installing Antlr and your patch. I will try it again tonight.
I don't quite understand the build instruction for antlr myself. I did the following (I think):
git clone git://github.com/antlr/antlr.git antlr cd antlr patch -p 0 < ${path to libmwparser}/antlr.patch mvn -N install cd antlr3-maven-archetype mvn -Dmaven.test.skip=true install cd ../antlr3-maven-plugin mvn -Dmaven.test.skip=true install cd ../runtime/Java mvn -Dmaven.test.skip=true install cd ../../tool mvn -Dmaven.test.skip=true install
I dont know if there is any install script, but you should place the antlr, antlr-runtime, and stringtemplate jar files somewhere appropriate and create a script called 'antlr3' somewhere in your path:
#!/bin/sh
CLASSPATH=/usr/share/java/stringtemplate.jar:/usr/share/java/antlr3.jar:/usr/share/java/antlr3-runtime.jar
exec java -cp $CLASSPATH org.antlr.Tool "$@"
As for the C runtime, something like this should work:
cd ../runtime/C aclocal automake --add-missing autoconf ./configure make make install
Another thing is that I am trying to port your grammar to Javascritp via PegJs. It is just beginning, dozens of rules had been converted; so far I did not meet any difficulty to convert from antlr to peg. But lots of works are needed.
There is a Javascript backend available for Antlr. Have you tried it? Of course, there would still be a lot of work in porting the supporting C code that implements, for instance, the contexts.
Best regards,
Andreas