编译原理实践

浅析AST抽象语法树及如何利用AST转换JS代码

7 行代码 3 分钟:从零开始实现一门编程语言

QBE 1.0 正式发布,编译器后端

The Super Tiny Compiler 超小型编译器 The Super Tiny Compiler 是一个仅有约 1000 行代码的迷你编译器,可用于把 LISP 语言编译成我们熟悉的 JavaScript 语言。

OCaml

lexer(词法分析)

parser(语法解析)

antlr4

Antlr - 强大的开源语法分析工具

Coco/R 较早的一个语法分析器生成工具。其生成语法分析器的语言极其之多,包括C#、 Java、 C++、F#、VB.Net、Oberon等等。

Lex & Yacc

语法分析器生成工具 YACC

Flex & Bison

flex和bison使用

JavaCC :开源语法解析

Grammatica is a C# and Java parser generator (compiler compiler)

astexplorer

13 个示例快速入门 JS 抽象语法树

babel 怎么把字符串解析成 AST

esprima js词法语法解析


> var esprima = require('esprima');
> var program = 'const answer = 42';

> esprima.tokenize(program);
[ { type: 'Keyword', value: 'const' },
  { type: 'Identifier', value: 'answer' },
  { type: 'Punctuator', value: '=' },
  { type: 'Numeric', value: '42' } ]
  
> esprima.parseScript(program);
{ type: 'Program',
  body:
   [ { type: 'VariableDeclaration',
       declarations: [Object],
       kind: 'const' } ],
  sourceType: 'script' }

The Future of Programming Languages

Zig

Nim

Vale

Haxe

carbon