LinuxConf.Au: Compilers and Factories
  • Video is free for view
View_video

The techniques presented in this paper came about from a project where it was known in advance that at least two tools needed to be based on the same grammar. The requirement was to translate an application-specific language into C, and also produce a pretty-printer. This is often done with two separate grammar files which differ not in syntax but in the semantic code added to each grammar production. Is it possible to have a single grammar file and use it in two different tools?

A technique is presented which separates the grammar from the semantic processing, using simple C++ polymorphism, allowing two or more tools to share the same grammar code. The use of factory methods makes this possible. The implementation of a grammar using these factories is described, as well as some unexpected benefits and simplifications.



Tags: LinuxConf.AU, C and C++, Lectures, Linux, Conferences, OS, Computer Science, Science

Level: any Date: March 21, 2007 Votes: 0 User: scoundrel  Comments:
 
 

1 Response(s) to this entry

Subscribe to comments with RSS.