Skip to content
/ jsvm2 Public

Javascript Interpreter implemented by typescript(TS实现的JS解释器)

Notifications You must be signed in to change notification settings

ximing/jsvm2

Repository files navigation

build workflow Coverage Status NPM npm bundle size

Specification

https://www.ecma-international.org/wp-content/uploads/ECMA-262_5th_edition_december_2009.pdf

使用方法

npm i -S jsvm2

参考 tests/helper.ts

语法支持情况

注:引擎表现为严格模式

ES5

  • File
  • Program
  • Identifier
  • NullLiteral
  • StringLiteral
  • NumericLiteral
  • BooleanLiteral
  • RegExpLiteral
  • VariableDeclaration
  • FunctionDeclaration
  • FunctionExpression
  • ArrayExpression
  • VariableDeclarator
  • ExpressionStatement
  • BlockStatement
  • ConditionalExpression
  • EmptyStatement
  • DebuggerStatement
  • WithStatement: t.WithStatement; // 不实现,@babel/parse 在严格模式下禁用 WithStatement
  • ReturnStatement
  • LabeledStatement
  • BreakStatement
  • ContinueStatement
  • IfStatement
  • SwitchStatement
  • SwitchCase
  • ThrowStatement
  • TryStatement
  • CatchClause
  • ForStatement
  • WhileStatement
  • DoWhileStatement
  • ForInStatement
  • ThisExpression
  • ObjectExpression
  • ObjectProperty
  • ObjectMethod
  • UnaryExpression
  • UpdateExpression
  • BinaryExpression
  • AssignmentExpression
  • LogicalExpression
  • MemberExpression
  • CallExpression
  • NewExpression
  • SequenceExpression

ES2015

  • VariableDeclaration (let/const)
  • ArrowFunctionExpression
  • TemplateLiteral
  • TaggedTemplateExpression
  • ForOfStatement
  • ClassDeclaration
  • ClassExpression
  • ClassBody
  • ClassMethod
  • MetaProperty
  • Super
  • TemplateElement
  • SpreadElement
  • YieldExpression
  • ObjectPattern
  • ArrayPattern
  • RestElement
  • AssignmentPattern
  • ImportDeclaration
  • ExportNamedDeclaration
  • ExportDefaultDeclaration

ES2016

  • BinaryExpression

ES2017

  • AwaitExpression

Experimental

  • ImportSpecifier
  • ImportDefaultSpecifier
  • ExportSpecifier
  • SpreadProperty
  • DoExpression
  • [ ]Decorator

Test

About

Javascript Interpreter implemented by typescript(TS实现的JS解释器)

Topics

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages