cobolscript
v0.0.1
Published
COBOL compiler to JavaScript
Downloads
7
Readme
CobolScript
COBOL language compiler to Javascript. Work in Progress
Installation
Via npm using (Node.js)[http://nodejs.org]:
npm install basicscript
Usage
Reference in your program:
var cobolscript = require('cobolscript');
To compile a source code:
var program = cobolscript.compileProgram('display "Hello, world".');
To compile a file:
var program = cobolscript.compileProgramFile('./hello.cob');
To run a compiled program:
program.run(cobolscript.getRuntime());
Some programs need a runtime object that provides helper functions, i.e. display
implementation. In the above example, a console-oriented runtime
object is obtained.
In web samples, a runtime that uses request, response is used:
http.createServer(function(req, res) {
program.run(cobs.getRuntime({ request: req, response: res }));
}).listen(8000);
Development
git clone git://github.com/ajlopez/CobolScript.git
cd CobolScript
npm install
npm test
Samples
Hello Simple Hello, world program, without division declarations.
Hello Program Hello, world program, with identification, environment, data and procedure divisions.
Hello Web Hello web page. display
output produces page content.
Factorial Factorial console program, using working storage variable, perform
with using
and giving
and local variables for recursion.
Factorial Web Factorial web page.
Local Using local
to define a variable, instead of working storage.
Template Console program using a template. CobolScript can be embedded in text.
Template Web Web page using a template.
Web Server Accessing Node.js functions, to start a web server and serves a single page.
To do
- More Samples
- Web Site with templates and layout, get and post processing
if
withelse
,end-if
perform
inline withend-perform
,until
,with test
.- explicit
stop run
. exit
,exit perform
.- File section.
- Linkage section.
- Pictures.
exec sql
.- Asynchronous call, using a procecure as a callback.
References
Contribution
Feel free to file issues and submit pull requests � contributions are welcome.
If you submit a pull request, please be sure to add or update corresponding
test cases, and ensure that npm test
continues to pass.