Parser Compiler
Last updated 2 months ago by galactrax .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @candlefw/hydrocarbon 
SYNC missed versions from official npm registry.

LALR Parser Compiler


Hydrocarbon is a LALR and GLALR parser compiler that uses a self hosted, custom grammar that is inspired by Backus-Naur syntax.

You can review the Hydrocarbon grammar definition in ./source/grammars/hcg. The definition is split across 5 files starting with hcg.hcg.

The primary reason this exists is to provide a flexible parser compiler to handle the parsing demands of the CandleFW libraries Wick, JS, and CSS. It provides a way to rapidly define new syntax and compile grammars of different languages into one meta-parser.


compile <hydrocarbon_grammar_file>

Compiles a JavaScript parser from a HydroCarbon grammar file

Output Path

-o, --output <path> Optional output location. Defaults to current directory. --statesout, Output a *.hcs file.

States File

[-s | --states] <states>
Use a *.hcs file from a previous compilation instead of a compiling the grammar file.

Environment File

[-e | --env] <path>
Optional JavaScript file containing parsing environment information.


[-m | --mount]
Mounts the compiled parser in the current NodeJS context and allows interactive parsing of command line input.

Grammar Name

[-n | --name] <output_name>, The name to give to the output file. Defaults to the name of the grammar file.

Skip Output

[-d | --no-out]
Skip writing to file.


[-c |--compress ] Minify output file.

Unattended Compilation

[-u |--unattended ]
Do not wait for user input. Exit to console when compilation is complete. Quits on errors.

Generated File Type

[-t |--type] <type> Type of file to output.The type can be: "mjs" - ( * .mjs) A module file for use with the modern ES2016 module syntax. "cjs" - ( * .c.js) A CommonJS module for use with NodeJS and other consumers of CommonJS. "js" - ( * .js)[Default] A regular JavaScript file that can be embedded in HTML.The parser will be available as a global value.The name of the global object will be same as the output file name.

Parser Type

--parser <parser> The type of compiler that hydrocarbon will create. Select from lalr1 and earling



Current Tags

  • 0.3.4-dev-1                                ...           latest (2 months ago)

12 Versions

  • 0.3.4-dev-1                                ...           2 months ago
  • 0.3.4-dev                                ...           2 months ago
  • 0.3.2                                ...           2 months ago
  • 0.3.1                                ...           2 months ago
  • 0.3.0                                ...           2 months ago
  • 0.1.7                                ...           4 months ago
  • 0.1.6                                ...           4 months ago
  • 0.1.5                                ...           4 months ago
  • 0.1.4                                ...           9 months ago
  • 0.1.3                                ...           9 months ago
  • 0.1.1-0                                ...           10 months ago
  • 0.0.1-a                                ...           a year ago
Maintainers (1)
Today 0
This Week 0
This Month 13
Last Day 0
Last Week 12
Last Month 0
Dependencies (6)
Dev Dependencies (1)

Copyright 2014 - 2016 © taobao.org |