Compiling a Hello World programIn this blog post I explain how to compile a "Hello World" program to a JavaScript program that can be executed in the browser.Read more...

Using the REPLIn this blog post I will explain how to use the REPL and play around with it.Read more...

What is Acheron Lisp?Well, I always explain it like this: Acheron is like the Google Web Toolkit (GWT), but instead of Java with Common Lisp (kind of). If you don't know what GWT does, this doesn't help you much. So let me explain what GWT does in its essence. GWT allows you ...

The main function will be called when the program starts executing. There is currently no write function in the standard library of Acheron Lisp, but we can easily define this function as a native function. The function declaration part of native functions is like normal functions defined with defun, but the function body of native functions consists of JavaScript code. Since JavaScript usage might depend on a particular browser implementation, native functions can be defined for each browser variant. In the example above, the write function is valid for any browser variant, denoted with the base keyword. I will explain native functions and the variant concept in a later blog post in more details.

The example program aboved is saved in the file HelloWorld.lisp. For simplicity, I assume that this file is stored in the folder /files.
To compile this program to JavaScript you have to first change the directory to the folder where you unzipped the compiler. To compile the program you have to type the following command:

If you have more than one source file to compile you can list them after ...CompilerMain. The folder where to put the compiled files is specified with the -o argument.

If everything goes well the compiled *.js files are stored in the folder /files. You will get a JavaScript file for each supported browser variant. In the current version of the compiler you will get these files:

compiled_file_IE_v7.js

compiled_file_IE_v7_compressed.js

compiled_file_IE_v8.js

compiled_file_IE_v8_compressed.js

compiled_file_MOZILLA_gecko1.8.js

compiled_file_MOZILLA_gecko1.8_compressed.js

compiled_file_MOZILLA_gecko1.9.js

compiled_file_MOZILLA_gecko1.9_compressed.js

The compiler addtionally outputs a compressed version for each browser variant.

For a future version there is a automatic browser detection planned. The browser detection will then load the appropriate JavaScript file for the detected browser. Having a separate variant for each browser reduces the runtime overhead for dynamic browser detection. This is the reason, why the compiler outputs a distinct JavaScript file for each browser variant.

If we want to execute the compiled file, we have to manually load it in a HTML file, for example like this:

Here the version for Internet Explorer 7 is loaded. It doesn't matter which file we load here, because they are all the same (for the example program). By calling the initFunction() we start executing the compiled main function.

You can download the example program here:Source file
And test the compiled application here:HTML file