[antlr-interest] .g vs .g4

Kirby Bohling kirby.bohling at gmail.com
Tue Nov 8 06:08:42 PST 2011


If Sam is saying it is only for the searching on imported grammers, it
sounds like the tooling won't care about the main one.  Imported
grammars already have a bunch of clunky aspects about their placement
and naming (at least IMHO, when building them inside Maven).  I've
used them, and they have great value once you figure out the secret
handshake.  Adding one more constraint there doesn't bother me nearly
as much as having one on the top most grammar file.

Kirby


On Tue, Nov 8, 2011 at 4:20 AM, Stuart Dootson <stuart.dootson at gmail.com> wrote:
> How about doing what GCC does, and provide a flag to allow hte user to
> specify the language being processed?
>
> In gcc, I could do:
>
> gcc -x c++ test.c
>
> To compile test.c as with the C++ compiler. I could also do
>
> gcc -x f77 test.c
>
> to compile test.c using the Forrtan 77 compiler...
>
> The default, however, is '-x none', which means 'look at the filename
> extension to determine the compiler to use'...
>
> Just a suggestion...
>
> Stuart Dootson
>
> On 6 November 2011 17:55, Terence Parr <parrt at cs.usfca.edu> wrote:
>
>> Hi Eric,I think we are going to allow .g as well.   Rather than a property
>> in the grammar file itself that identifies the version, I think we were
>> going to use the file extension for this reason. all v3 grammars will be .g
>> and people building v4 grammar should name them .g4
>> Ter
>> On Nov 6, 2011, at 9:29 AM, Eric wrote:
>>
>> >
>> >
>> > On Sun, Nov 6, 2011 at 12:22 PM, Terence Parr <parrt at cs.usfca.edu>
>> wrote:
>> > Hi, Sam Harwell and I are talking about the file extension for new ANTLR
>> 4. We think it makes good sense to use .g4 to distinguish the new grammars.
>> They're mostly compatible except that there is no need for syntactic
>> predicates and .g4 allows immediate left recursion. I think it will reduce
>> confusion about what version of ANTLR is necessary to compile a grammar.
>> >
>> > Ter
>> >
>> > List: http://www.antlr.org/mailman/listinfo/antlr-interest
>> > Unsubscribe:
>> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>> >
>> >
>> > Hi Ter,
>> >
>> > Will v4 require the file type to be .g4, or will it accept .g and .g4?
>> >
>> > My preference is for .g4 only.
>> >
>> > Also, will there be a property in the grammar file that identifies the
>> minimum version or required version. I think it would help for obvious
>> reasons such as when a user post a grammar needing help or an example
>> grammar is given.
>> >
>> > Thanks, Eric
>> >
>> >
>>
>>
>> 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