Heard of V8 but haven’t got a clue how to run it? Here’s a quick guide to get you started. This guide is intended for Mac OS, but there are detailed Windows instructions.
Step 1: Get Scons
Assuming you’ve already got Xcode installed, get Scons. V8 uses this as its build tool. It’s easy to install from source, but you could also use MacPorts. MacPorts will fetch a whole bunch of dependencies — if you’re on Leopard or Snow Leopard you should be OK to just build it yourself.
I installed it like this:
sudo python setup.py install
Step 2: Build V8
Fetch V8 from the Google Code subversion repository:
svn checkout http://v8.googlecode.com/svn/trunk/ v8
Then build V8 and the sample shell:
scons # Wait for a bit... scons sample=shell
You will be able to run the interpreter with
Step 3: A Less Painful Interpreter
To get command history and more, install
rlwrap. I actually did install this from ports.
Step 4: Hello World
V8 version 126.96.36.199 > print("hello world"); hello world >
I also tried a library I wrote, with insanely fast results: