ledsun.hatenablog.com の続きです。Node.jsで動くJavaScriptインタプリタを実装しようとする試みです。 作戦 パーサにはEsprimaを使う TDD的なスモールスタート戦略で進める(最初はセルフホスティングを意識しない) 下調べ EsprimaがどのようなASTを返すか確認します。 準備 Esprimaをインストールします。 npm init -y npm install esprima ASTを見る REPLでパース結果を確認します。 nodeコマンドでREPLを起動し ~ node > const esprima = require('esprima') undefined > const util = require('util') undefined > console.log(util.inspect(esprima.parse('1 + 1')