Bluish Coder

Programming Languages, Martials Arts and Computers. The Weblog of Chris Double.

Posts tagged “javascript”

51 posts

Installing GNAT and SPARK GPL Editions

GNAT is an implementation of the Ada programming language. SPARK is a restricted subset of Ada for formally verifying programs. It provide features comparable to languages like Rust and ATS. A recent article comparing SPARK to Rust caught my eye and I decided to spend some time learnig Ada and SPARK. This post just outlines installing an implementation of both,... more →

WebM Decoder in Flash using Alchemy

Ralph Hauwert has been posting on twitter about work he's done on getting WebM decoding to work in Flash by compiling the libvpx source code using Adobe's Alchemy technology. Alchemy is a research project that allows compilation of C and C++ libraries into code that runs on the ActionScript virtual machine used by Flash. Ralph originally tweeted: more →

Prototype Based Programming Languages

I've been reading up on protoype based programming languages recently. Mainly using the Io Programming Language and Self but also looking at LambdaMOO and similar languages. A good overview of using the prototype based approach to building programs is Organizing Programs without Classes. This post is based on examples from that paper and from Attack of the Clones which covers... more →

Reading Ogg files with JavaScript

On tinyvid.tv I do quite a bit of server side reading of Ogg files to get things like duration and bitrate information when serving information about the media. I wondered if it would be possible to do this sort of thing using JavaScript running in the browser. The format of the Ogg container is defined in RFC 3533. The difficulty... more →

Simple Nanojit Example

I've been playing around with Nanojit, thinking about using it in a toy project of mine. Nanojit is a library for generating machine code with backends for x86 and ARM. It's used by Tamarin and TraceMonkey for their just in time compilers. The Mozilla documentation contains some documentation which gives an overview of what's there: more →

JavaScript Space Invaders Emulator

Ajaxian recently posted about a fun JavaScript implementation of PacMan. After spending way too much time on it I wondered how well an emulation of the old arcade game hardware would go in JavaScript. I've written a few 8080 arcade game emulations before in different languages so I had a go at implementing it in JavaScript. You can try the... more →

A Quick Introduction to Tamarin Tracing

2008-05-20: Fixed some breakage due to changes to the latest Tamarin Tracing source, and updated more recent timing. I attended the Tamarin Tech summit at Adobe on Friday. My main interest for attending was to learn more about the tamarin-tracing project. The goal of Tamarin is to produce a high performance ECMAScript 4 implementation. 'Tamarin Tracing' is an implementation that... more →

Implementing Native Methods in Tamarin Tracing

2008-05-20: Minor update to get things working with latest Tamarin Tracing code, and updated times for test runs. Tamarin Tracing can be extended by creating native methods. These are methods of a class where the implementation is in C rather than JavaScript. For this example I'll use a native implementation of the fibonacci function and compare it to the JavaScript... more →

Building the ActionScript compiler for Tamarin

Adobe have released the Flex SDK as open source. The trunk of the SDK repository contains the source to the ActionScript compiler and the GlobalOptimizer component that can be used for generating code used in Tamarin Tracing. To build the asc.jar required by Tamarin, first get a copy of the current source, change to the 'modules/asc/build/java/' directory and run 'ant'... more →

Javascript Packrat Parser

I've made some changes to my parser combinator library written in Javascript that I wrote about previously. I was extending the example code from that post to parse more of the ECMAScript 3 grammar to test it out and was hitting performance issues. I ended up modifying the combinator library to be a Packrat style parser. The Parsing Expression Grammar... more →

Javascript Parser Combinators

Cleaning up my hard drive I came across some old libraries I'd written. One of them was a simple set of parser combinators written in Javascript. I put it in a git repository in case they prove useful to someone: git clone git://github.com/doublec/jsparse.git more →

Standard ML to Javascript compiler

smltojs is a compiler from Standard ML to Javascript. According to the page it has support for all of Standard ML. Since the reference implementation of Ecmascript 4 is written in Standard ML it would be interesting to see if it can be built using this compiler. That would provide an es4 implementation that runs in the browser based off... more →

Javascript on the Server

Running Javascript on the server seems to be gaining in popularity. Last year I wrote a small framework to test writing web applications in Javascript. Tony Garnock-Jones later extended this to support building continuation based web applications. More recently, Peter Michaux has taken my original code and made a nicer web framework out of it. John Resig has written a... more →

ECMAScript Edition 4 Reference Implementation

Brendan Eich has posted about the availability of a reference implementation of ECMAScript Edition 4. ECMAScript Edition 4 is the new version of Javascript being designed. The reference implementation is written in SML (Standard ML). More information is at the Lambda The Ultimate posting about it. more →

Asynchronous Javascript

Ajaxian has a post about a new abstraction based around the recent Google Gears API for executing Javascript asynchronously. What the Google Gears API provides is the ability to execute Javascript in a different browser thread, and to communicate with those threads via simple message passing. The new abstraction referenced in the Ajaxian post expands on this to allow registering... more →

Dynamic Code Generation and Image Files

An image based programming language like Factor stores executable code in an image file. When Factor starts up it loads the image and starts executing the code stored in it. I wanted to explore some ideas with images and dynamic code generation so wrote a simple example on how to generate assembly, store it in an image and later load... more →

Concurrency via Generators in Javascript 1.7

Neil Mix, the author of Narrative Javascript, has a post about implementing concurrency in Javascript 1.7 using the new generators feature of the language. His example is here and the threading code behind it is just 4K. The example requires Firefox 2.0 for the new Javascript 1.7 features. more →

Narrative Javascript beta 1 released

Neil Mix has made Beta 1 of Narrative Javascript available. This release includes an official threading API with support for futures. I'll be revisiting my previous examples of using threading and futures with Narrative Javascript to move things over to this new API. more →

Flapjax

Flapjax is a very interesting looking client side browser framework. It's a superset of Javascript that provides Functional Reactive Programming to the client side browser. From the Flapjax website: more →

Slipwave Javascript libraries

I came across slipwave today which has a number of interesting Javascript libraries. Of interest to me is js.lang.Recompiler which does a CPS transform of Javascript code, similar it seems to Narrative Javascript. On top of this is built a thread library including thread groups and semaphores. Other libraries include a Javascript interpreter written in Javascript. more →

More on Ajax and server push

So far I've looked at two ways of doing server push. The first used a hidden IFRAME which had the SRC attribute set to a persistent connection on the server. The server would push Javascript code along this connection whenever it wanted the client to do something. This had the downside of the browser always displaying a 'loading' indicator as... more →

Migrating Javascript Threads

A while ago in my old weblog I posted some Sisc Scheme code to demonstrate a thread migrating from one Sisc session to another. Since Rhino, the Java based Javascript implementation, has serializable continuations I decided to try porting it to Javascript. The code demonstrating it is in migrate.js. Loading this into a Rhino session provides a function called 'messageListener'... more →

Associative Arrays and Javascript

Andrew Dupont has a post about Associative Arrays in Javascript. He makes the good point that you shouldn't use the Array object for this functionality, instead use 'Object'. Unfortunately using 'Object' has its own set of pitfalls. Try the following code in your favourite Javascript implementation: var x = {} x["toString"] more →

Phobos available for download

Phobos appears to be available for download now. Phobos is the server side javascript system that Sun is making available. Robert Chinnici has a blog outlining features of Phobos and answering the question about why you'd want to use Javascript on the server. more →

E4X with Server Side Javascript

I've updated the Server Side Javascript distribution to include an example which uses E4X. E4X is described in Ecma-357 and adds a Native XML syntax to Javascript. The XML is converted to a Javascript object which can be used to query and manipulate the XML. The E4X example servlet generates the XHTML to be displayed using: var result = <html>... more →

More concurrency in Narrative Javascript

I've added to my lightweight threading example in Narrative Javascript to include support for sending and receiving messages between processes. The style of communication is based on the Erlang style of concurrency whereby processes communicate by sending messages. The threads2 example is here. This page has two processes running on it. They start when the page loads. Both processes block... more →

Javascript 1.7

It looks like Javascript 1.7 is getting some interesting new features. Brendan Eich did a presentation about what is being added and changed. One that looks useful for the concurrency things I'm playing with is destructuring assignment: var [a, b, c] = [ 'one', 'two', 'three' ]; more →

Narrative Javascript

Narrative Javascript extends the Javascript language to include a new operator. That operator allows writing procedural looking code that spans asynchronous operations. Very much like continuations enable writing web applications such that you don't need to break application flow to model the HTTP protocol, Narrative Javascript enables you to write your code in a sequential style and have it automatically... more →

Server side Javascript

An update to the code demonstrating E4X support is here. Ajaxian is reporting that Sun is releasing Phobos, a Javascript application server. This is a web server that runs Javascript for implementing the server side code. The source has not yet been released, according to Ajaxian, but will be. A while back I worked on doing server side Javascripting using... more →

Amazon S3

I've been playing around with Amazon S3 for a project I'm working on and I'm quite impressed with it. Amazon S3 provides unlimited storage for $0.15 per gigabyte storage and $0.20 per gigabyte of bandwidth. Once you sign up and get an account you can create 'buckets' which are named collections of stored objects. Each bucket acts as a billing... more →

Python to Javascript

Simon posted a comment on my post about the C# to Javascript compiler pointer out that there is a Python to Javascript system. So far I've come across converters to Javascript from the following languages: more →

Script# - C# to Javascript compiler

Nikhil Kothari has a post on a C# to Javascript compiler. Similar in approach to Google's Web Toolkit it allows you to program your client side web code in C# and compile it to Javascript. From this: using System; using ScriptFX; using ScriptFX.UI; namespace HelloWorld { more →

Google Web Toolkit

This is pretty nifty. Google have released 'Google Web Toolkit'. It's a system for writing ajax applications in Java. The Java code is compiled into Javascript which then runs in the browser. From the Google site: more →

Dojo and Spidermonkey

I attended the sessions on Dojo at the Ajax Experience conference to learn a bit about it. Previously I'd considered Dojo to be a large, hard to understand library but I came away quite impressed with it after attending the seminars related to it. You can use the included package mechanism to make the base package fairly small and have... more →

Why the Scheme->Javascript JIT doesn't work on Firefox

After doing some digging I've found a bug in the Scheme-in-Javascript implementation that seems to be the reason the JIT doesn't work on Firefox. The system uses Javascript objects as associate arrays (hashtables), mapping symbols names to definitions. For example: TopEnv['eval'] = function(list) { return doEval(list.car); } more →

Lightweight threads in the browser

I've made some updates to the Scheme in Javascript library. You can run it at the jsscheme page. I've split out the example scheme source and made it loadable via Ajax. To do this I use jQuery, a very nice Javascript library. I added a Scheme wrapper around the Ajax GET call so you can do code like this: (ajax-get... more →

Scheme Implementation in Javascript

A post on Lambda the Ultimate recently was about an Oberon interpreter written in Javascript, allowing Oberon to be embedded in the browser. This reminded me of an near-R5RS compatible Scheme written in Javascript called jsScheme. It's a very nice implementation to play with but is IE 6 only. I've done some hacking at it and made it compatible with... more →

Javascript Partial Continuations

I've been playing around with Rhino, a Javascript interpreter written in Java, using it as a server side scripting language. Rhino supports continuations so I thought I'd try and port the bshift and breset implementation I ported to Factor to Javascript. My initial attempt is in partial-continuations.js.This can be loaded into the Rhino interpreter using: load("partial-continuations.js") more →

Pushing events from the server to the browser

I've written in the past about the ways of pushing events from the server to the web browser. Recently a this model of usage has had a term defined for it called 'Comet'. My plan was to have a library that modelled a web page as an asynchronous Erlang process. Other Erlang processes can send it messages using the standard... more →

Augment

If you think that we've made great progress in computer systems over the last ten years, take a look at Brad Neuberg's screencast of the Augment system developed in the 60's. Augment is the first system developed with groupware, email, outlining and interaction with the computer. Many of the 'new' features we see today are evident in the Augment system.... more →

Javascript and Generators

Could Javascript be getting generators, iterators and list comprehensions? This post from Brendan Eich is a status update about the future of Javascript that mentions the possibility (From Ajaxian). js> function count(n) { for (var i = 0; i < n; i++) yield i; } js> g = count(10) [object Generator] js> g.next() 0 js> g.next() 1 js> two_to_nine =... more →

Observers, Erlang and Server Push

As I've mentioned previously, I'm working on a framework for pushing events from an Erlang based web server to browser based clients using AJAX. My goal being to make it look like normal Erlang message sends to 'processes' running on the browser. I have a server process that needs to broadcast events to interested parties whenever something of interest happens.... more →

Backbase LiveGrid and DataGrid

Backbase have released version 3.1.1 of their rich internet application framework. It contains a large number of 'web 2.0' goodies. The two big ones are live grid and data grid components. The live grid is a paging component that lets the user just use a scroll bar to lazily load data frmo the server. Only the items displayed in the... more →