Setting Grammar Properties

Syntax

Property Definition

Details

Many attributes of a grammar cannot be specified using Backus-Naur Form statements or regular expressions. These attributes can range from the formal name of the grammar to how parse tables will be constructed by the system. As a result, the Builder must allow the developer a means to declare this information within the meta-language.

The role of properties is nebulous by design. Some may set the formal name of the grammar, for instance, and others can have significant impact on how the system constructs parse tables. Property names are delimited by doubled-quotes and can be set to any of the symbols and literals recognized by the GOLD Meta-Language. In most cases, the value will be a string.

The properties are as follows:

Property Name Type Description
Name Optional The name of the grammar.
Version Optional The version of the grammar.   This can contain any alphanumeric string.
Author Optional The grammar's author.
About Optional A short description of the grammar.
Case Sensitive Optional Whether the grammar is considered to be case sensitive. When this parameter is set "True", the GOLD Builder will construct case sensitive tokenizer tables (DFA). In other words, if your language contains a terminal 'if', the text 'IF', 'If', and 'iF' will cause a syntax error. This parameter defaults to 'False'.
Character Mapping Optional For now, the only valid values are Windows-1252 and None. The system defaults to Windows-1252 - which populates characters 128 to 159 as needed. This documentation contains a chart of the characters affected.
Auto Whitespace Optional In the previous version of the GOLD Parser, the whitespace terminal was always created when omitted in the grammar. Unfortunately, not all grammars make use of whitespace. This parameter is set to 'True' by default, but can be changed to 'False'. When 'False', the system will not automatically create a whitespace terminal unless it is manually defined.
Virtual Terminals Optional

Using this property, the developer can specify a series of terminal names. The system will enter these terminals into the symbol table, but they will not be entered into the Deterministic Finite Automata. As a result, the terminals will not be recognized by the lexer, but can, instead, be created by a specialized version of the Engine or by the developer. This can help developers parse languages which are not context free - such as Python.

This feature was added in Version 2.2 of the Builder. In Version 5, you can set a terminal to "Virtual", but assigning its attributes.

Start Symbol Required The starting symbol in the grammar. When LALR parse tables are constructed by the GOLD Builder, an "accepted" grammar will reduce to this nonterminal.

Example

"Name"    = 'My Programming Language'
"Version" = '1.0 beta'
"Author"  = 'John Q. Public'

"About"   = 'This is a test declaration.'
          | 'You can use multiple lines by using the "pipe" symbol'

"Case Sensitive" = 'False'
"Start Symbol" = <Statement>