mini-parser小轮子

代码链接 demo如下,定义好rule后进行parse。 const rule = AndRule.of( [ TextRule.of("hello", "HELLO_RULE"), OrRule.of( [TextRule.of(", "), TimesRule.of(3, TextRule.of(" ", "SPACE"), "TIMES")], "NO_NAME" ), TextRule.of("world", "WORLD"), OneOrMoreRule.of(TextRule.of("!"), "SAMPLE") ], "HELLO_WORLD" ); console.log(JSON.stringify(rule.accept("hello world!!!"))); 结果为: { "contain": true, "group": { "groups": [ { "text": "hello", "name": "HELLO_RULE" },...

November 6, 2019

slisp:一门简单的JVM上的Lisp方言

之前经常变更学习方向,没有收到很好的学习效果,浪费了不少时间。最近痛定思痛,把方向定为JVM和编译原理,这次真的不改了。本文是学习该方向的阶...

January 1, 2019

Arcee:又一个Parser Generator轮子

项目地址:https://github.com/gcnyin/arcee 为什么要做这样一个东西呢?不是有Antlr吗,Python下不是也有...

September 2, 2018