Overview
GOLD is designed to aid in the development of compilers, interpreters and translators
while supporting multiple programming languages. To accomplish this goal, the system takes
advantage of the LALR and DFA. Both of these can be implemented with simple state
transition graphs. As a result, it is very easy to write the algorithms in different
programming language since the logic simply looks up a value in a table and then acts
accordingly. The creation of these tables is where all the "thinking" takes
place.
The GOLD Parsing System is composed of two different components, the
"Builder" and the "Engine", and the a file that is stores table
information. The "Builder" constructs the parse tables. The "Engine"
uses the tables.
The Components
The Builder
The Builder is used to read a source grammar written in the GOLD Meta-Language, produce the LALR and DFA parse
tables, and, finally, save this information to Compiled Grammar Table file. The Builder
Application runs on the Windows 32-bit operating systems which include, but are not
limited to, Windows 9x, Windows NT and Windows XP. The application also contains a number
of features which could have been implemented as different programs. Each feature was
included to create an easy-to-use integrated development environment. These include the
ability to create skeleton programs and the ability to interactively test a grammar.
There is also a command-line version of the Builder. In the future, the Builder may be
ported to different operating systems such as UNIX, Linux, and Mac-OS.
Compiled Grammar Table File
The Compiled Grammar Table file is used to store table information generated by the
Builder.
The Engine
The Engine component performs the actual parsing. The Engine can be developed in any
programming language necessary. Since all the complex work was already performed the
Builder, the Engine simply needs to read the Compiled Grammar Table file and implement the
LALR and DFA automatas.
As different implementations of the Engine are created for different programming
languages, the approach and design will vary. Since different programming languages
use different approaches to designing programs, each implementation of the Engine will be
a little bit different. As a result, an implementation of the Engine written for
Visual Basic 6 will differ greatly from one written for ANSI C.
Due to the work of kind and generous contributors, there are numerous Engines at your
disposal. Please visit the Engine Download page for some more
information. |
|
Development Overview
Step 1.
The first step to designing your compiler or interpreter is to write a grammar for the
language being implemented. The description of the grammar is written using any text
editor - such as Notepad or the editor that is built into the GOLD Builder. This does not
require any coding.
Step 2.
Once the grammar is complete, it is analyzed by the GOLD Builder. During this
process, LALR and DFA parse tables are constructed and any ambiguities or problems with
the grammar are reported. Once the grammar is analyzed, the tables are saved to a Compiled
Grammar Table file to be used later by the actual parsing engine. At this point, the GOLD
Parser Builder is no longer needed - having performed its duties.
Step 3.
Finally, the parse tables are read by the parsing engine. The Engine can be implemented
in any number of programming languages. Each Engine works a little differently - using the
programming style and paradigm that best suites the language.
In all cases, the source text is analyzed by the parser engine and a parse tree is
constructed. |
|
|