Input Parser discussion

Input decks are presently parsed by a somewhat ad hoc recursive descent method, implemented by parse_XXX() routines. Command names are followed by lists of modifiers and parameters; some commands allow extended tables of auxiliary data.

Typically keywords are distinguished by 4 leading characters, and are recognized anywhere that they appear after a command name, offering rich opportunities for obscurity (although these may not be widely exploited).

A more regular, and more feature-rich, input syntax could be supported. Possibilities to generate this would be refactoring the present recursive-descent code (an example C++ recursive descent parser is included in Stroustrup), or using lexical analysis and parser generation (cf Aho et al.)

For the latter option,

  • Lexical analysers produced by flex are free [verify].
  • Output from the GNU parser generator, bison, is licensed under the GPL. Berkeley yacc, see http://invisible-island.net/byacc/byacc.html, is compatible with the standard AT&T yacc and produces output which can be covered by the standard Cloudy license.