× News Cego SysMT Croom Web Statistics Impressum
SysMT Logo

The Dragon Parser Generator

Users guide ( covers cego version 1.5.0 )
by Bjoern Lemke, 27.07.2018

Cego comes under the GNU Copyright
(C)opyright 2000-2018 by Bjoern Lemke

Also there are ( beside of lex and yacc) a lot of parser generation tools are available, this is another implementation of a powerful parser generator. The dragon approach results in a consequent object oriented integrated scanner and parser solution and scales also for very large grammar defintions.

Since dragon parses LR(1) grammars, the generation algorithm is quite cpu intensive building the sets of LR(1) elements. Using LR(1) instead of LALR decreases efficiency of the parser but avoids some reduce/reduce conflicts in some cases. For huge grammar defintions, state-of-the-art hardware ( especially CPU ) is strongly recommended.

Dragon provides a very clean and structured way for the integration application specific context code. Further, dragon combines the lexical and syntactical analysis and the corresponding code generation. The grammar is completely defined in a single description file.

As a result, dragon generates C++ class code that can be in included as a parser class. From version 1.2, dragon also supports generation of Java code. The code integration and usages is quite similar.

From dragon version 1.3, LALR parser generation mode is also supported and is used as default.

From version 1.5, dragon can also generate GoLang code.

If you have built and tested the dragon software and find it useful ( or not ), I appreciate some feedback from you. Thanks in advance !

Table of Contents (TOC)

1   Who should use it ?
2   Getting Started
2.1   ... Java code generation
2.2   ... C++ code generation
2.3   ... GoLang code generation
3   Grammar definition
3.1   ... Header
3.2   ... Tokenset
3.3   ... Productions
4   Generating the parser
4.1   ... Parser conflicts
4.1.1   ... Shift/reduce conflict
4.1.2   ... Reduce/reduce conflict
5   Parser analysis mode
6   Advanced scanner feed
7   Semantic actions
7.1   ... Sample action method
8   Advanced scanner feed
8.1   ... Advanced C++ scanner
8.2   ... Advanced GoLang scanner
9   Parser analysis mode
10   Conclusion