A glance on PEG.js

It really reminds my course "automata" in the university.

https://pegjs.org/online

How to read the online sample:

  • {var name}: {matching rule} { return ... // you can use var name } , var name is an array containing all the matched tokens in the rule
  • the engine will try to match each expression

This is really-really cool.

You can probably use it to implement something like https://github.com/jquery/esprima with less effort

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 12,151评论 0 10
  • 内容总结香农对于信息论的两点洞见,第一就是一条信息的信息量的大小在于他克服了多少不确定性,因此,一首诗的信息量比一...
    上善若水在路上阅读 3,301评论 0 1
  • 【1】 年前去美容院做护理的时候,认识了一位做保险的姑娘。大概是因为我们都脾性比较相似,所以不到半个小时,我们就火...
    蓝小歌阅读 3,262评论 2 5
  • 谢冠宏说他是工程师出身,一点都不适合演讲。 确实,从他演讲的气息中你可以感觉到他的紧张,甚至有时候没听明白他要表达...
    常知了了阅读 2,498评论 0 1