Prev Next

Example Grammars

The Code Samples directory set up by the Enterprise Architect installer contains an example Grammar that you can load into the Grammar editor to review, and into the Grammar Debugger to parse and profile.

The Grammar example consists of two files:

  • test.ssl - a simple sample language source file, in the style of C, and
  • ssl.nbnf - a grammar for the simple sample language

The example illustrates:

  • Tokenization (using the Lexer)
  • Creation of a Package
  • Creation of a Class or Interface
  • Creation of an attribute
  • Creation of an operation (with parameters)
  • Importing comments

The Code Samples directory also contains two other Grammar files that you can examine:

  • Expressions Sample.nBNF - this illustrates how expression parsing is set up and processed, with detailed comment text providing explanations
  • CSV Sample.nBNF - an example grammar for processing CSV files

Learn more