background preloader

JavaScript

Facebook Twitter

Prototype JavaScript framework: a foundation for ambitious web applications. jQuery UI. Three.js - JavaScript 3D library. How to write a simple interpreter in JavaScript. Download source - 2.9 KB Writing interpreters and compilers Writing an interpreter or a compiler is one of the most educational tasks in programming because you can become familiarized with the details of the code interpretation and evaluation process. You can obtain much deeper knowledge of what sorts of things are going on behind the scenes and gain some insights into the decisions behind language design. This article will perform a basic overview of this process by showing how to write an interpreter for a simple language that we can use for a calculator application.

This article assumes that you have intermediate programming experience and basic familiarity with Javascript. Some Background The difference between interpreters, compilers and transpilers In this article, we will be creating an interpreter, as opposed to a compiler. A transpiler is similar to a compiler, except that the source language and target language are about the same level of abstraction. Lexing Parsing Evalutation. Pure JavaScript HTML Parser. Recently I was having a little bit of fun and decided to go about writing a pure JavaScript HTML parser. Some might remember my one project, env.js, which ported the native browser JavaScript features to the server-side (powered by Rhino). One thing that was lacking from that project was an HTML parser (it parsed strict XML only). I’ve been toying with the ability to port env.js to other platforms (Spidermonkey derivatives and the ECMAScript 4 Reference Implementation) and if I were to do so I would need an HTML parser.

Because of this fact it became easiest to just write an HTML parser in pure JavaScript. I did some digging to see what people had previously built, but the landscape was pretty bleak. The only one that I could find was one made by Erik Arvidsson – a simple SAX-style HTML parser. (I also contemplated porting the HTML 5 parser, wholesale, but that seemed like a herculean effort.) However, the result is one that I’m quite pleased with. Htmlparser.js: 4 Libraries in One! YUI 2 — Yahoo! User Interface Library. YUI Library. Unbeatable JavaScript Tools - The Dojo Toolkit. Backbone.js. Node.js. CoffeeScript.