Giter Club home page Giter Club logo

ecma262-jison's Introduction

用js的Lex/Yacc工具来实现和扩展ECMAScript规范,学习ECMAScript规范并尝试打造一个parser。

Nothing increases your learning power more than working on something big, real, confusing and frustrating.

查看在线示例

安装

npm install ecma262-jison

构建

Nodejs v6版本以上,推荐使用v8或更高版本

git clone https://github.com/w-y/ecma262-jison.git

构建parser:

npm run buildparser

src到lib:

npm run build

测试:

npm run test

特性

目前已实现ECMAScript(7.0)的大部分语法特性,并扩展了JSX支持

特性 支持 备注
Arrows
Classes
Template Strings foo`` ❌
Destructuring
Default+Rest+Spread
Let + Const
Unicode \u{20BB7} ❌
Modules
Enhanced Object Literals
Generators
jsx
Spread Element
Spread Property
ASI                       出错加分号重试方式

示例

const code = 'foo;';

const parser = require('ecma262-jison');

const ast = parser.parse(code);

console.log(JSON.stringify(ast, null, 2));

在线示例

ecma262-jison's People

Contributors

dependabot[bot] avatar w-y avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

zy1620454507

ecma262-jison's Issues

Performance and Productive use cases.

Hello again.

Is this project just a "learning experience" or something that is meant to be a "productive" library at some point?

The reason I am asking is because as a productive library I fear it may have great difficulty competing with hand crafted parsers (Acorn/Esprima/Cherow/...) in terms of performance.

See: performance benchmark of parsing libraries

  • Try on Chrome (V8)
  • Jison is pretty slow
  • Optimized hand crafted parsers will be faster than the one used in that benchmark.
  • I am guessing a Jison based parser would have 3-5% of the performance of something like Acorn/Esprima...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.