[antlr-interest] Tutorial... actual use? & BSD question
Tenaja
tenajahiker at yahoo.com
Mon Nov 8 09:33:59 PST 2010
Zach,
Thank you for responding. I think maybe my inquiry was unclear. I've read the "five minute intro..." and have used antlr to process several samples, producing code in Java, C, C#, etc,. (It's very simple...) Unless the output=AST is different from those output commands (output = csharp), it is probably not what I'm interested in.
What I'm looking for is a 5-minute tutorial on using the output; for instance, sending a file to the compiled C# output, and having that C# code process the text file and generate a result. My end goal is a simple compiler to produce some Intermediate Representation (Three-Address, or PCode, etc).
...
On another topic, regarding the BSD license, since this is the first time I've worked with o/s code generation tools.
.....The non-C output does not include a copy of it.
.....The C output includes the BSD notice at the top.
So, does that mean that I'm free to compile and distribute binary forms of Java & C# output code without the license, but not C? Does that mean the only requirements for distributing the C in binary form are to put it in an About box, or something equivelant? Why would the C output require it, but not the other languages? I may eventually turn this into a commercial product so I'd like to know how much disclosure is required.
Thanks!!!
--- On Sun, 11/7/10, Zachary Palmer <zep_antlr at bahj.com> wrote:
From: Zachary Palmer <zep_antlr at bahj.com>
Subject: Re: [antlr-interest] Tutorial... actuala use?
To: antlr-interest at antlr.org
Date: Sunday, November 7, 2010, 5:16 PM
Tenaja,
By default, the generated ANTLR grammar is just a recognizer: it will
throw an exception in the presence of a string not in the grammar and it
will terminate normally in the presence of a string in the grammar. To
get more output from ANTLR (such as an AST), you probably want to set
"output=..." in the options section of your grammar. For an informal
discussion of "output=AST", try
http://www.antlr.org/wiki/display/ANTLR3/Tree+construction . For more
detailed information, there is a relatively inexpensive book ("The
Definitive ANTLR Reference") that you can buy in electronic form.
For more examples, you might try taking a glance at some of the grammars
on the ANTLR site (http://www.antlr.org/grammar/list). There's also a
somewhat non-standard approach that I've been forced to use (due to some
strange constraints in my project) which is illustrated by the ANTLR
grammar used in a branch of the OpenJDK project in which each rule
explicitly returns the values that it needs (which are then set by
grammar actions).
Cheers,
Zach
> I'm familiar with bnf (etc) files, and have written a simple r/d compiler myself. I'm looking at antlr for expanding, and for maintenance reason. As such, I'd like to put together one of my simple bnf languages and view the output. I've seen a few antlr tutorials, but haven't found one that really describes the compiled code output (not the antlr output, but what a compiled exe or java file output produces).
>
> So... can someone point me to a tutorial that shows what to do AFTER you compile the anltr-generated file?
>
> Thanks!
> Tenaja
>
>
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>
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