miaoYu

miaoYu正在翻译

How to implement a programming language5 (Compilation to JavaScript)

原文链接: lisperator.net

Compilation to JavaScript

To make our λanguage more efficient, instead of evaluating (interpreting) the AST we should transform it into a program in our target language (JavaScript). Then we can run it with eval or new Function (or load it with a tag) and I promise you that the speed improvement will be dramatic. I've split this work in three parts:

It might seem weird that I'm starting with what should be, intuitively, the “last phase” (code generation). I do that because it's fun and easy, and it will help us implement and debug the latter phases. We will only need minor modifications in the code generator after the latter stages.

© Mihai Bazon 2012 - 2017

Proudly NOT powered by WordPress.

Humbly powered by Common Lisp.