|Date:||Thu, 27 Sep 2007 22:20:53 +0200|
|Keywords:||parse, tools, available|
Hello to everybody!
I just wanted to inform you about a new parser generator project I
released the last days. It is the JS/CC, a LALR(1) parser generator
the concepts of the lex/yacc behavior, but unions both a lexical
analyzer generator for matching the tokens of a language, and a
LALR(1) parser generator for parsing the language structure as defined
using a BackusNaur form-based meta language.
The characteristic, that JS/CC is capable to compile and run a
complete parser from a grammar definition within a web browser makes
it very useful for educational purposes. JS/CC can even be executed
via command-line on Microsoft Windows systems using the Windows Script
Host or JScript.NET executable to do the job.
JS/CC was released as open source software under the Artistic License.
A simple example grammar to be compiled using JS/CC is this
/~ --- Token definitions --- ~/
/~ Characters to be ignored ~/
! ' |\t' ;
/~ Non-associative tokens ~/
'[0-9]+' INT [* %match = parseInt( %match ); *]
'[0-9]+\.[0-9]*|[0-9]*\.[0-9]+' FLOAT [* %match = parseFloat( %match ); *]
/~ Left-associative tokens, lowest precedence ~/
/~ Left-associative tokens, highest precedence ~/
/~ --- Grammar specification --- ~/
p: e [* alert( %1 ); *]
e: e '+' e [* %% = %1 + %3; *]
| e '-' e [* %% = %1 - %3; *]
| e '*' e [* %% = %1 * %3; *]
| e '/' e [* %% = %1 / %3; *]
| '-' e &'*' [* %% = %2 * -1; *]
| '(' e ')' [* %% = %2; *]
When this is put to the JS/CC web-interface, it builds a complete,
working parser out of this augmented grammar definition.
To get JS/CC, visit the official project website at http://jscc.jmksf.com
Thanks a lot!
Return to the
Search the comp.compilers archives again.