This project is a implementation of JS/CC to nodejs (version >= 0.4.7).
The platform-independent software unions both: A regular expression-based lexical analyzer generator matching individual tokens from the input character stream and a LALR(1) parser generator, computing the parse tables for a given context-free grammar specification and building a stand-alone, working parser. The context-free grammar feeds to JS/CC is defined in a Backus-Naur-Form-based meta language, and allows the insertion of individual semantic code to be evaluated on a rule's reduction.
To use JS/CC and for understanding its internals and behaviors, some knowledge of context-free grammars, bottom-up parsing techniques and compiler construction theory, in general, is assumed.
For all documentation read the
jscc_manual.pdf in doc/ folder.
npm install jscc-node
This install a jscc binary inside your node path, that you can run from the shell
jscc [options] filename
-h --help Print this usage help -i --version Print version and copyright -o --output <file> Save output source to <file> -p --prefix <prefix> Use <prefix> as sequence pre-fixing methods and variables -t --template <file> Use template file <file> as parser template (by default driver_node.js_ is located in root folder) -v --verbose Run in verbose mode -w --warnings Print warning messages -c --compress Compress output source using PACKER BASE62 -s --shrink Shrink variables of output source using PACKER -cs --compress-shrink Shrink variables of output source and Compress output source -m --minimize Minimize output source using PACKER
For sample grammar see par/ folder. You will find - dragon.par : My own language (Implementation in progress...) - php.par : PHP grammar from phype project (implementation of php in progress...) - ruby.par : Ruby grammar from 8ball project (implementation of ruby in progress...) - calc.par : Calculator grammar from JS/CC sample - xpl.par : Grammar for eXample Programming Language from JS/CC sample