Go to file
2019-01-29 12:13:09 +03:00
documentation first commit 2019-01-28 15:08:59 +03:00
examples first commit 2019-01-28 15:08:59 +03:00
lemon-src rm 2019-01-28 15:16:25 +03:00
parsers/filters fix 2019-01-29 11:03:14 +03:00
build.sh add build 2019-01-29 12:13:09 +03:00
config.template add time and tests 2019-01-29 11:02:47 +03:00
main.js fix test 2019-01-29 12:09:17 +03:00
package.json first commit 2019-01-28 15:08:59 +03:00
README.md add build 2019-01-29 12:13:09 +03:00
test.js fix test 2019-01-29 12:09:17 +03:00

Compile lemon-js

gcc -o ./lemon-src/lemon-js -O2 ./lemon-src/lemon-js.c

npm install

or

./build.sh

Start

You need create your config.js from config.template

node main.js --c=<your_config>.js --t=<web|node>

default config -> config.js

Test

Also you can test your parser

node test.js --c=<your_config>.js

Also

You can use this syntax for include your *.y file.

<&&REPLACER{<file_path>}&&>

Special Directives

See lemon.html for additional documentation.

  • %name - Set parser class name (default is "Parse")
  • %include - Include code in the beginning of file (usefull for imports)
  • %code - Include code in the end of file (usefull for exports or main code)
  • %token_destructor - Define code which will be executed on token destruction.
  • %default_destructor
  • %token_prefix - Define token name prefix.
  • %syntax_error - Define custom error handler for syntax erorrs.
  • %parse_accept - Define handler for all accepted tokens.
  • %parse_failure - Define handler for parse errors.
  • %stack_overflow - Define handler for stack overflow.
  • %extra_argument - NOT SUPPORTED
  • %token_type - NOT SUPPORTED
  • %default_type - NOT SUPPORTED
  • %stack_size - Set default stack size.
  • %start_symbol
  • %left - Set left associative tokens.
  • %right - Set right associative tokens.
  • %nonassoc - Set non associative tokens.
  • %destructor - Define custom parser destructor.
  • %type - NOT SUPPORTED
  • %fallback - Define fallback logic for tokens.
  • %wildcard - Define WILDCARD token.
  • %token_class - NOT SUPPORTED

Original project

See https://github.com/sormy/lemon-js