Difference between revisions of "Make your own compiler, interpreter, parser, or expression analyzer"

From Free Pascal wiki
Jump to navigationJump to search
m (titles size change)
m (moved tools)
Line 23: Line 23:
 
TBD
 
TBD
  
== Useful tools ==
+
== Useful BNF and EBNF tools ==
 +
* [http://www.garshol.priv.no/download/text/bnf.html BNF and EBNF metasyntax formal notations for writing grammars]
 +
* [http://bottlecaps.de/rr/ui EBNF to Syntax Diagram online convertor]
 +
* [https://sourceforge.net/projects/ebnfvisualizer/ EBNF Visualizer]
 +
* [https://www.ctan.org/tex-archive/support/syngen Syngen - tool for generating syntax diagrams from BNF in LaTeX format]
  
 
== See also ==
 
== See also ==
Line 29: Line 33:
 
* [https://compilers.iecc.com/crenshaw/ Let's build a compiler]
 
* [https://compilers.iecc.com/crenshaw/ Let's build a compiler]
 
* [http://memphis.compilertools.net/interpreter.html Writing an interpreter]
 
* [http://memphis.compilertools.net/interpreter.html Writing an interpreter]
* [http://www.garshol.priv.no/download/text/bnf.html BNF and EBNF metasyntax formal notations for writing grammars]
 
* [http://bottlecaps.de/rr/ui EBNF to Syntax Diagram online convertor]
 
* [https://sourceforge.net/projects/ebnfvisualizer/ EBNF Visualizer]
 
* [https://www.ctan.org/tex-archive/support/syngen Syngen - tool for generating syntax diagrams from BNF in LaTeX format]
 

Revision as of 03:54, 11 September 2018

Lex and Yacc

Two of the oldest unix tools. Lex is a lexical analyser (token parser), and Yacc is a LALR parser generator. BNF notation is used as a formal way to express context free grammars. Code and grammar are mixed, so grammar is tied to implementation language.

Plex and Pyacc

Plex and Pyacc are pascal implementations of Lex and Yacc and they are part of your FreePascal distribution.

Lazarus Lex and Yacc

You can find unfortunately abandoned Lazarus Lex and Yacc here.

Gold

Gold is a free parsing system that you can use to develop your own programming languages, scripting languages and interpreters. It uses LALR parsing, and a mix of BNF notation, character sets and regular expressions for terminals to define language grammars. Code and grammar are separated, so grammar is not tied to implementation language. This means that the same grammar can be loaded into engines made in different programming languages.

GOLD Parser Builder can be used to create, modify and test languages in Windows IDE which can also run on Wine. Command line tools are also available.

Gold Parser Builder has grammar editor with syntax highlighting, grammar generating wizard, test window to step through parsing of a sample source, templating system that can generate lexers/parsers or skeleton programs for various languages (including Delphi and FreePascal), import/export YACC/Bison, XML and HTML export, and interactive inspection of the compiled DFA and LALR tables.

There is a feature comparison table of several parsers on Gold site, with special attention to Gold vs Yacc comparison.

AntLR

TBD

Coco-R

TBD

Useful BNF and EBNF tools

See also