[antlr-interest] dumbie question: Are there any examples ofbuilding antlr programs using different IDEs?

Graham Wideman gwlist at grahamwideman.com
Tue Oct 27 01:54:40 PDT 2009


Raymond,

The matter of using Antlr to generate java files for parser or lexer can be separated from the matter of using your IDE.  You can run antlr from the command line, using whatever kind of grammar file (lexer, combined, parser, tree) and tell it to send the output (java) files to the directory of your choice. That can be a directory that's within a project as set up by your IDE, and thus can be referenced (called) by other files in your project. (You may need to prod the IDE to refresh its knowledge of the files when you change them like this.)

With that arrangement, you don't have to learn how to get the IDE's build system to run external programs, though usually that's not too involved and not particularly special for antlr. Of course, not having the IDE automatically run antlr means you have to do that step manually when you change the grammar, but at least it gets you started. Also you then know what's supposed to happen, so that when you do automate it you'll know that it is or isn't working properly.

>From another angle, your choice of IDE should be driven by other considerations within your project or larger development process, not by whether there's an incremental learning effort for automating antlr: even if that effort is too much at present, you can put that off by running antlr manually.

-- Graham


At 10/26/2009 11:26 PM, Jacob, Raymond CIV SPAWARSYSCEN-ATLANTIC, wrote:
>I have a dumbie question regarding where can I find examples of how
>to build an antlr program using different IDEs?
>
>
>Background: I am not a java programmer.
>I have read part of the antlr book by Terrence Parr.
>I think I have gotten as far as the Chapter that use STL to build
>programs. I can not
>remember the exact chapter because I don't have the book
>in front of me.
>I did not say I understood everything in the book.
>I think I understand a few of the examples.
>
>An intern with more brain cells than I have left was developing
>a program using netbeans. So I thought I would give netbeans a
>try. That was about 5 months ago and I still have not figured
>out how to use netbeans to build a grammar with like the examples
>in the book. For instance, I can not figure out how to get the
>IDE to use a separate file for a lexer-the file with the tokens instead
>putting
>all the tokens and the grammar in one file. As far as I can tell
>in order to build a grammar in netbeans I need to know ant
>and modify the build.xml to add the plug-in for antlr in netbeans.
>
>I realize now that I would have been further along if I had
>just used the command line instead of an IDE. But what has
>not been done is done. 
>
>Question: Are there any IDEs that make it easy or natural to
>build programs using the code in the Antlr reference
>book? i.e. I want to focus on the code in the book and not the IDE.
>
>If there are not any IDEs for the IDE challenged, 
>are there any examples of building antlr programs using different IDEs?
>
>I apologize in advance for my ignorance.
>When I searched the list my Google-fu was weak and I could not find
>anything relevant.
>
>Thank you again
>rjjr
>
>
>
>
>List: http://www.antlr.org/mailman/listinfo/antlr-interest
>Unsubscribe: 
>http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list