Some of the generated output results in hard-to-diff generated code when
the source is changed. For a while now, I've been trying to think of
what to name an option that would limit this content in the generated
code. Here is a list of the items that are notorious for this, grouped
by whether or not they are "necessarily difficult"  (meaning
non-removable).

 

Difficult items that could be removed from the output:

 

*         Timestamps

*         Source line/column numbers

 

Difficult items that can't be easily removed from the output:

 

*         DFA tables

*         Temporary variable names like "alt1" and the follow set
variable names where they include decision numbers

 

I think I have two ways to proceed at this point:



1.       I can generate code in the build process and place all
generated output in the temporary build directory instead of
side-by-side with the grammar files. In this case, it's assumed that no
generated files will be checked into source control and each person that
builds the project will be building grammar files (if the source .g file
changed) as part of their local builds. It would be important in this
case to both a) make sure that the compiled code is the same regardless
of when/where the project was built as long as the tool version is the
same and b) make sure that grammars that import other grammar's tokens
files build in the correct order.

2.       Generate grammar files and place the generated code in the same
folder as the grammar file itself. For source control purposes, it's
important in this case to a) make sure the generated code is "as
diffable as possible" and b) don't attempt to write the output if the
source file didn't change since the last time the code was generated
(going past just file modification times, this means not writing the
output if the output currently on disk has the same contents as would be
written).

 

What I'm looking for is opinions on:

 

1.       Which build configuration seems preferable?

2.       What should I name the command line switch that strips
unnecessary "non-diffable" content from the generated code.

_______________________________________________
antlr-dev mailing list
[email protected]
http://www.antlr.org/mailman/listinfo/antlr-dev

Reply via email to