GOLD (parser)

GOLD (parser)

Infobox_Software
name = GOLD Parsing System



caption =
developer = Devin Cook &
[http://www.devincook.com/goldparser/contributors Multiple Contributors]
latest_release_date = 2007-07-29
latest_release_version = 3.4.4
operating_system = Windows
operating_system_desc = Windows 32-bit
genre = Parsers - LALR
license = Freeware & Open Source
website = [http://www.devincook.com/goldparser www.DevinCook/goldparser]

GOLD is a freeware parsing system that was designed to support multiple programming languages.

Design

The system uses a DFA for lexical analysis and the LALR algorithm for parsing. Both of these algorithms are state machines that use tables to determine actions. GOLD is designed around the principle of logically separating the process of generating the LALR and DFA parse tables from the actual implementation of the parsing algorithms themselves. This allows parsers to be implemented in different programming languages while maintaining the same grammars and development process.

The GOLD system consists of three logical components, the "Builder", the "Engine", and a "Compiled Grammar Table" file type which functions as an intermediary between the first two.

Builder

The Builder is the primary component and main application of the system. The Builder is used to analyze the syntax of a language (specified in a grammar) and construct LALR and DFA tables. During this process, any ambiguities in the grammar will be reported as a conflict. This is essentially the same task that is performed by compiler-compilers such as YACC and ANTLR.

Once the LALR and DFA parse tables are successfully constructed, the Builder can save this data into a Compiled Grammar Table file. This allows the information to be reopened later by the Builder or used in one of the Engines. Currently, the Builder component is only available for Windows 32-bit operating systems.

Some of the features of the Builder are as follows:

* Freeware license
* State Browsing
* Integrated Testing
* Test multiple files wizard
* Generate Webpages (including hyperlinked syntax charts)
* Generate skeleton programs using templates
* Export grammars to YACC
* Export tables to XML or formatted text

Compiled Grammar Table File

The Compiled Grammar Table file is used to store table information generated by the Builder.

Engine

Unlike the Builder, which is dependent on a single platform, the Engine component is written for a specific programming language and/or development platform. The Engine implements the LALR and DFA algorithms. Since different programming languages use different approaches to designing programs, each implementation of the Engine will vary. As a result, an implementation of the Engine written for Visual Basic 6 will differ greatly from one written for ANSI C.

Currently, the following programming languages are supported by GOLD. Any language can be implemented by translating the existing source code.

* Assembly - Intel x86
* ANSI C
* C#
* D
* Delphi
* Java
* Pascal
* Python
* Visual Basic
* Visual Basic .NET
* Visual C++

Grammars

GOLD grammars are based directly on Backus-Naur Form, regular expressions, and set notation.

The following grammar defines the syntax for a minimal general-purpose programming language called "Simple".

"Name" = 'Simple'"Author" = 'Devin Cook'"Version" = '2.1' "About" = 'This is a very simple grammar designed for use in examples'

"Case Sensitive" = False "Start Symbol" =

{String Ch 1} = {Printable} - ["] {String Ch 2} = {Printable} - ["]

Identifier = {Letter}{AlphaNumeric}*

! String allows either single or double quotes

StringLiteral = " {String Ch 1}* "
'"' {String Ch 2}* '"'

NumberLiteral = {Number}+('.'{Number}+)?

Comment Start = '/*'Comment End = '*/'Comment Line = '//'

::=

::= display
display read ID
assign ID '='
while do end
if then end
if then else end ::= '>'
'<'
'<='
'>='
'='
'<>'

::= '+'
'-'
'&'

::= '*'
'/'

::= '-'

::= Identifier
StringLiteral
NumberLiteral
'(' ')'

Development Overview

Design the Grammar

The first step consists of writing and testing a grammar for the language being parsed. The grammar can be written using any text editor - such as Notepad or the editor that is built into the Builder. At this stage, no coding is required.

Construct the Tables

Once the grammar is complete, it is analyzed by the Builder, the LALR and DFA parse tables are constructed, and any ambiguities or problems with the grammar are reported. Afterwards, the tables are saved to a Compiled Grammar Table file to be used later by a parsing engine. At this point, the GOLD Parser Builder is no longer needed.

elect a Parsing Engine

In the final stage, the tables are read by an Engine. At this point, the development process is dependent on the selected implementation language.

External links

* [http://www.devincook.com/goldparser/ GOLD Parsing System Homepage]
* [http://www.devincook.com/goldparser/contributors List of Contributors]
* [http://tech.groups.yahoo.com/group/goldparser/ GOLD Yahoo Group]


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать реферат

Look at other dictionaries:

  • Gold (disambiguation) — Gold is a highly sought after precious metal that for many centuries has been used as money.Gold may also refer to:Business* Barrick Gold, the largest gold mining company in the world * Gold s Gym, international chain of fitness centers… …   Wikipedia

  • GOLD — refers to one of the following: * GOLD (IEEE) is an IEEE program designed to garner more student members at the university level (Graduates of the Last Decade). * GOLD (parser) is an open source BNF parser. * GOLD stands for Gathered or linked… …   Wikipedia

  • GOLD Parsing System — GOLD Parsing System …   Deutsch Wikipedia

  • Gold (Begriffsklärung) — Gold steht allgemein für: Gold (Au), ein Edelmetall und chemisches Element Gold (Farbe), einen warmer Gelbton ein heraldisches Metall, siehe Tingierung#Metalle Goldmedaille, Auszeichnung für den Sieger von (insbes. sportlichen) Wettkämpfen… …   Deutsch Wikipedia

  • Gold Cap — Doppelschicht Kondensatoren, auch elektrochemische Doppelschicht Kondensatoren (engl. electrochemical double layer capacitor EDLC) oder Superkondensatoren genannt, mit den Markennamen Goldcaps, Supercaps, BoostCaps oder Ultracaps, haben die… …   Deutsch Wikipedia

  • Comparison of parser generators — This is a list of notable lexer generators and parser generators for various language classes. Contents 1 Regular languages 2 Deterministic context free languages 3 Parsing expression grammars, deterministic boolean grammars …   Wikipedia

  • Irrlicht Engine Extentions — Being the open ended project it is, the Irrlicht Engine has various first party and third party extensions to even further power up the engine.VideoThere are no known extensions for the video rendering capabilities of Irrlicht.AudioirrKlangAudio… …   Wikipedia

  • David Jenkins (athlete) — Olympic medal record Men’s Athletics Silver 1972 Munich 4x400 metre relay Men s European Championships Gold 1971 Helsinki 400 m Silver …   Wikipedia

  • Parsing — In computer science and linguistics, parsing, or, more formally, syntactic analysis, is the process of analyzing a sequence of tokens to determine their grammatical structure with respect to a given (more or less) formal grammar.Parsing is also… …   Wikipedia

  • Stochastic context-free grammar — A stochastic context free grammar (SCFG; also probabilistic context free grammar, PCFG) is a context free grammar in which each production is augmented with a probability. The probability of a derivation (parse) is then the product of the… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”