Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm using a parser generator to build a compiler. Should I commit the source files produced by the parser generator?

I want to commit them to avoid a dependency on the parser generator during the build process and tests.

However, if I commit them, it is tempting never to update the parser generator for fear of backwards-incompatible changes.

Are there other advantages or disadvantages that I have not thought of?

References:

share|improve this question
add comment

2 Answers

up vote 12 down vote accepted

My suggestion is no, you should not commit machine generated files. Source control should be reserved for original (source) material only, not intermediate files. Do you commit compiled objects to source in case the compiler changes? You problem almost certainly lies in configuration management (of the tool chain), not source management. Unfortunately source control is too often used to achieve both.

In the first instance I would look closely at build configuration. Is it possible to treat the parser outputs as another tool the build process used, and have a project to build the parser outputs. Look for solutions in this space first

If other options have been explored and deemed too expensive or technically difficult etc, it is not the worst evil in the world to commit the files to source control - the sun will still rise in the east tomorrow morning.

share|improve this answer
    
As my build process matures, I'll know more about the expense of omitting the parser from version control. If you found my question "shows research effort; .. is useful and clear" please upvote. Thanks. –  Jared Beck Sep 1 '13 at 20:42
3  
In addition to what @mattnz said, a build pipeline on a builder server should be a superset of a build pipeline on your local machine. I.e. it should do more than your local build process. –  CodeART Sep 1 '13 at 20:56
2  
I disagree. It's often useful to have generated files (I'm not talking binaries here—just intermediate code) in the source control as well to facilitate finding and understanding bugs as ddyer already said. –  Dan Sep 2 '13 at 7:21
add comment

You should commit all three components (parser generator, input language, and output language) to source control, to help disentangle the blame when unexpected problems arise.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.