Göran Krampe 01de379433 Some improvements to TrivialServer, we can call require from class side initializer, as long as we skip using var so that we actually modify the global variable. 13 years ago
..
hello 93156f8c48 Cleanups and better docs of nodejs stuff. 13 years ago
trivialserver 01de379433 Some improvements to TrivialServer, we can call require from class side initializer, as long as we skip using var so that we actually modify the global variable. 13 years ago
README 18efc83e71 Better nodejs README and slightly friendlier ntalkc script. 13 years ago
nodecompile.js 93156f8c48 Cleanups and better docs of nodejs stuff. 13 years ago
ntalkc 18efc83e71 Better nodejs README and slightly friendlier ntalkc script. 13 years ago

README

JTalk + Node.js = Awesomeness
=============================
These are some experiments of using JTalk together with Node.js:

ntalkc - a bash script for compiling JTalk programs for Node.js.
nodecompile.js - trivial Node.js javascript code for compiling .st files, used by ntalkc.

hello - Hello world example with a simple Makefile
trivialserver - A slightly larger example.

You will need "node" in your path to try examples.


ntalkc
======

The "compiler" is simply a bash script that uses Nicolas' Exporter/Importer to compile .st files into .js files. The source code should be easy to follow but basically it does the following:

1. Collect all listed (as arguments) .st and .js files. We also check in the JTalk js and st directories if not found.

2. Create a "compiler" by concatenating these files (this means we always use freshest from git):
boot.js Kernel.js Parser.js Compiler.js init.js nodejs/nodecompile.js

3. Run this "compiler" using node and give .st files as command line arguments. This produces corresponding .js files. If not all .js files exist afterwards we abort.

4. Build final program.js by concatenating:

boot.js
Kernel.js
...all .js libraries collected in step 1.
...all .js files produced from the .st files in step 3.
init.js (either locally or from JTalk js directory)
main.js (if found locally)

5. Run program.js using node if "-r" was specified.