Hacker News new | comments | show | ask | jobs | submit login
Show HN: Parametrized recursive descent parser in JS
2 points by megous 11 months ago | hide | past | web | favorite
I wrote an abstract recursive descent parser in JS which accepts an array of terminal (in regexp form, or as a list of string literals) and a list of non-terminal definitions and returns the function that will parse the text.

The parser "generator" has just 125 lines of code and it is an extremely lightweight solution to quickly produce purpose made languages in the browser without need for any tooling.

Together with `` template strings to write your custom made language code in, it makes for a lot of fun in JS. :D

Someone asked for the code in the recent thread about parsers. You need to search for it a bit though. CTRL+U :)


Applications are open for YC Summer 2018

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact