All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javacc-7.0.4.www.doc.javacc-c++-releasenotes.html Maven / Gradle / Ivy





	 
 JavaCC Release Notes




JavaCC [tm]: Release Notes for the C++ version

Javacc is extended to support C++ code generation starting with version 6.0. The generated code mostly uses the same design as the Java version.

C++ specific issues

Since C++ is somewhat different from Java in code organization in terms of header files etc., we made the following changes:

  • Parser class in PARSER_BEGIN/PARSER_END - this cannot be supported as the parser is generated into the header file. So in the C++ version you can only define the contents of the class, not the class itself.
  • Include files - in order to write any action code for the lexer/parser/tree, you might need to include header files. So we allow to specify what the header file is for each of the components - see the list of C++ options below for more details.
  • Limitation on code in actions - since we don't have a full C++ parser embedded in the JavaCC grammar, we don't support arbitrary C++ code. So be aware of this when you write the actions. In general, it's a good idea to make them all function calls.
  • Object lifetimes - in general, the parser deletes all the objects it creats - including the tokens. So any data that you want to pass out of the parser should be copied to your own objects that you can return. Note that tree created is a "return value" of the parser so that's not deleted.
  • Exceptions - due to the way the code evolved, we could not use exceptions in C++. So we have an ErroHandler interface instead which by default just prints syntax error and continues trying to parse. Please see the apiroutiunes.html documt for more details.
  • Wide character support - C++ version is fully wide character compatible and it has been tested on Windows, Linux and Mac environments.

-------------------------------------------------------------------
*******************************************************************
-------------------------------------------------------------------

STARTING WITH VERSION 6.0

Implemented all JavaCC options for the C++ version as well.

Added new options relevant to C++:
  -NAMESPACE - namespace to be used for all the generated classes.
  -PARSER_INCLUDES - a single include file that gets includedin the parser. Use this to include all the declarations needed for your actions.
  -PARSER_SUPER_CLASS - super class of the parser class (as we do not allow class declaration in PARSER_BEGIN/PARSER_END for C++)
  -TOKEN_INCLUDES - a single include file for the token class
  -TOKEN_MANAGER_INCLUDES - a single include file for the TokenManager
  -TOKEN_MANAGER_SUPER_CLASS - super class of the token manager
  -IGNORE_ACTIONS - an option to ignore all the action so a clean parser can be generated even when jjtree is used. Useful for debugging/profiling/testing




© 2015 - 2024 Weber Informatics LLC | Privacy Policy