Blog

problem: antlr not generating .java files for .g file

hi

I am new to antlr. I have installed antlr3 on eclipse helios. I am using Ubuntu 10.04. I started with the basic example for creating a parser, but my antlr is not generating .java files for my .g file. kindly help.

Thanks!

How do I deal with Tab + new line chars in Antlr?

Hello everyone,

I'm having some trouble dealing with a tab character comes before a new line character. 

The image below (the second line of the image) exemplifies what I'm talking about:

-----> FAIL

-------> OK

The grammar I've made doesn't consider TAB + NL the same way that just using NL.

The section that I define the rules for white spaces and new lines is the following:

WS : (' ' | '\t' | '\f')+ {$channel = HIDDEN;};
NL : ('\n' | '\r')+ ;

Any hint on that? I've tried already '\t\n', '\t\r'.

thanks

Debugging, Decompiling or Round-Tripping the Target Language

I am sure this is worthy of an RTFM, but given the sheer weight of documentation for a newbie, I will risk the flames. In fact, whatever else I might get, one thing that might help me is a list of chapters and/or links in the ANTLR documentation, that would lead me reasonably efficiently towards my goal.

My goal:

I am interested in understanding in an orderly, principled way (if such is possible), the manner in which one might build a 'config-file'-driven translation of data into code, that can also be used to de-compile the very same code or "properly" edited code, back into the data that generated it or would have generated it in the first place.

Specifically, I want to translate an XML document into an editor and editing structures, that allow some 'valid' set of actions, that translate back into the XML that could have generated in in the first place. But I am less interested in tips and techniques for how to accomplish my goal than in the principles to guide thinking about the problem. To some extent, that is because I recognize (admit defeat?) the open-ended nature of the problem. Or should I?

Thanks,

Nick

ANTLR3.3.jar VS ANTLR2.7.7 jar

Get it while it's hot! ANTLR 3.3.

A bug fix and enhancement release: http://www.antlr.org/download.html

Grab the new Language Design Patterns book now! Learn to build configuration file readers, data readers, model-driven code generators, source-to-source translators, source analyzers, and interpreters. You don't need a background in computer science--ANTLR creator Terence Parr demystifies language implementation by breaking it down into the most common design patterns. Pattern by pattern, you'll learn the key skills you need to implement your own computer languages.

The basic deal is that new chapters will appear roughly every two weeks until it's in final form. I have three more chapters (or is it four?) to write.

For those of you registering for the ANTLR/StringTemplate workshop this weekend, you get a free copy of the beta book. (smile)

Howdy, we're doing an ANTLR Conference 2009, hosted by Univ. of San Francisco right after JavaOne 2009.  June 6, 7.

Get latest ANTLR release while it's hot.

I'm working away on the new book. Chock full of useful patterns. (sorry for all the buzzwords in the title/subtitle). We might do a PDF beta in a few months.

Thanks to the extraordinary efforts of Jim Idle, we now have ANTLR fully integrated/build with maven. Maven provides an auto-syncing repository so that new release are available within 4 hours of release and makes it easy for people other than me to build ANTLR. If you install the Maven plugin into your IDE (Netbeans/IDEA/Eclipse) then you will find that you can open the directory that contains the ANTLR source code (look for the pom.xml file) in the IDE and it will automatically know how to build and test the software.

A further side effect is that you no longer need to build your own development snapshots. We have also implemented an instance of the Hudson continuous build server. Here you can find the latest build status of all the ANTLR tools and you can download the latest development snapshot, if you are not using Maven.

You can find the hudson reports at: http://www.antlr.org/hudson (JIRA is still at http://www.antlr.org/jira)

Finally, if you are a Maven user and for some reason feel the need to build with the latest snapshot releases (perhaps to get a bug fix and so on), then you can connect to the ANTLR snapshot repository by specifying it in your maven pom.xml file as follows:

<project> ...
    <!--
    Inform Maven of the ANTLR snapshot repository, which it will
    need to consult to get the latest snapshot build of the runtime
    and tool directories if it was not built and installed locally.
    -->
    <repositories>
        <!--
        This is the ANTLR repository.
        -->
        <repository>
            <id>antlr-snapshot</id>
            <name>ANTLR Testing Snapshot Repository</name>
            <url>http://antlr.org/antlr-snapshot</url>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
        </repository>
    </repositories>
...
</project>

It's 1.2 with latest ANTLR 3.1.1 Download.

Get it while it's hot! http://www.antlr.org/download.html