I had to write a parser for a language. I decided to break out my Programming Language Concepts text book from my 3rd year of college. In that class we learned not only how to compare and contrast programming languages, but we learned how to write parsers for those languages. Since this is a direct application of the course material, I brought my text book to work. I gave myself a refreshing on the theory behind parsers.
With this refreshed knowledge, I started with writing down the Backus-Naur Form of the language. I created a Lexical Analyzer for the language based on a Finite State Machine that returns Token classes that I created. I created classes for an Abstract Syntax Tree that represent the expressions in the BNF. I created a parser that converts the token stream from the Lexical Analyzer into the Abstract Syntax Tree.
So far, everything I did to write this parser was quite literally text book. I created a text book parser. Imagine my surprise when someone accused me of stealing the code!
For starters, the developer couldn't believe I would be able to write a full featured parser for the language so fast. It was just not imaginable. Second, he didn't know what an Abstract Syntax Tree was. You see, I used a naming convention for my tree classes. I prefixed all of them with AST for Abstract Syntax Tree. Since this developer had never heard of an AST before, he did a quick google search for ASTExpression (one of the classes that I wrote). He saw some open source projects that used the same class name. He immediately assumed that I must have stolen the open source code. Nevermind the fact that the contents of the classes were different. It would be impossible for two developers to use the same class name! Therefore, I am a thief!
For me, my code was an example of software engineering done right. I used documented practices that multiple software engineers use. These standard practices mean people who are familiar with the standard practices can support my code. Unfortunately, the legacy of this code is an accusation theft.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.