Code Snippets Jison

Short texts Jison 🧑‍💻 Code snippets Jison ✍️ Reading lists Jison 👀

Simplest Jison

/* simple parser */ /* lexical grammar */ %lex letter [a-zA-Z]{1} digit [0-9]{1} other .{1} %% {letter} return ‘LETTER’; {digit} return ‘DIGIT’; {other} return ‘OTHER’; return ‘ENDOFFILE’; \n return ‘NEWLINE’; /lex %% /* language grammar */ start : ENDOFFILE { console.log(’empty string’); $$ = [] } | list ENDOFFILE { $list = [] } ; […]