Is there a formal (ideally BNF) typescript js language grammar (or only typescript subset)?

好久不见. 提交于 2019-11-30 05:14:05
Tony BenBrahim

The formal grammar is in Appendix A of the TypeScript Language Reference, version 1.8 if which is found here or here (for current version)

Since typescript is a strict superset of Ecmascript 5 (http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf/), you could exend any ecmascript bnf with syntax definitions from the Typescript spec.

A starting point could be: http://www.antlr3.org/grammar/1153976512034/ecmascriptA3.g

Maybe you can find references in the source code, e.g. compiler/tokens.js

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!