TypeScript implementation of the Jack compiler and VM translator, as described in The Elements of Computing Systems by Noam Nisan and Shimon Schocken.
import { CommandType, Parser } from "jsr:@r2/jack";
const parser = new Parser("push constant 7\npush constant 8\nadd");
while (parser.hasMoreLines()) {
parser.advance();
console.log(parser.commandType()); // -> "C_PUSH", "C_PUSH", "C_ARITHMETIC"
}This project is a work in progress. Some features may be incomplete or subject to change. Feedback is welcomed!
This project is based on The Elements of Computing Systems by Noam Nisan and Shimon Schocken.