> From: Anthony W. Youngman > > In message <673774b77dfb453c985a9d7053ec2...@dfw5rb41>, Gary > R. Van Sickle <[email protected]> writes > >> Another improvement would be to allow a comma-separated list. > >> With it one can record all versions of ANTLR, with which > the grammar > >> works without any modifications. > > > >The trouble with that is that it forces the user to predict > the future. > >Maybe it will work with the next fifty versions, which may only have > >changes which don't affect the ultimate interpretation, such as bug > >fixes, speed improvements, and the like, but there's no way > to specify that. > > > >The only way this sort of thing works is for the source file > to declare > >"this is the standard I was written to". It is then up to the > >interpreters, past, present, and future, to either modify their > >interpretation to match that of the specified standard (i.e. future > >ANTLR versions "degrading" their > >interpretation) or simply bail (e.g. ANTLR 3.1.2 tries to read a > >grammar that says its written to the ANTLR 8.5.6 standard, > which it of > >course has no idea what that even is, so it can't possibly > interpret it). > > Look at how Lilypond handles versioning (oh - and I think > lily's parser got rewritten in Antlr a while back - I'm not > sure but I certainly see the odd Antlr ref on the mailing list :-) > > Each version of Lily knows what is the oldest version of the > syntax it supports, so if 2.12.2 sees "version 2.12.0" in an > input file it's quite happy. If it sees 2.11.59 it bails with > "this input file is too old - run convert-ly". I don't know > what it would do if it saw 2.12.6. > > But basically, it knows at what point there were incompatible > syntax changes, and objects if you try to feed it an old > file. Okay, it might (or might not) be a bit more work in > Antlr deciding at what points to break backwards > compatibility, but it might also make life easier - keep > compatibility over several versions because you can, then > break it and Antlr knows to object about old input. > > Cheers, > Wol > -- > Anthony W. Youngman - [email protected]
Yep, that's exactly what I'm suggesting. The file indicates what version of the language it was written to, the interpreter of the file decides what to do based on that version info. -- Gary R. Van Sickle List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---
