On Thu, Dec 17, 2009 at 3:05 AM, Henri Verbeet hverbeet@gmail.com wrote:
If it's not ok to require Java to build (and I could imagine that), we could check in ANTLR's output. Then only people hacking on cmd would need java installed.
Well, at least Alexandre as well, and I could imagine distributions wanting to generate those files themselves as well.
Sure. And they can do 'apt-get install antlr3' or the equivalent pretty easily.
IIRC ANTLR also includes its own IDE/editor, although it's probably not required to use that.
You certainly don't need to use any ide.
It seems to me like it would be less trouble to either use bison/yacc or write something by hand, like most of the other parsers in Wine. The more interesting problem is of course finding someone to work on it in the first place.
The two problems are not unrelated. It's possible that finding somebody willing to use antlr would be easier than finding somebody willing to use yacc or write it from scratch.
I'm also biased towards hand-written parsers, but the cmd language is big and hairy; it's tempting to try prototyping the parser with antlr before diving in to write it by hand. And who knows, maybe the antlr version would suffice.
I'm trying to build "hello, antlr" now as a reality check. ... ok. Here's what I had to do for a java example on jaunty:
Copy and paste the grammar and test program from http://www.antlr.org/wiki/display/ANTLR3/Expression+evaluator into Expr.g and Test.java
sudo apt-get install antlr3 antlr3 Expr.g javac -cp .:/usr/share/java/antlr3-3.0.1+dfsg.jar Test.java ExprLexer.java ExprParser.java
It originally gave me the error ExprParser.java:163: warning: [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.HashMap memory.put(ID2.getText(), new Integer(expr3)); ^ but that just meant the example is for old java; I had to update the line HashMap memory = new HashMap(); to HashMap<String,Integer> memory = new HashMap<String,Integer>();
Then all went tickety-boo, no gui involved, and the demo worked.
Now to try the same thing in C. But sleep first.