<commit_before># 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:
```js
var cobolscript = require('cobolscript');
```

To compile a source code:
```js
var program = cobolscript.compileProgram('display "Hello, world".');
```

To compile a file:
```js
var program = cobolscript.compileProgramFile('./hello.cob');
```

To run a compiled program:
```js
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:
```js
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](https://github.com/ajlopez/CobolScript/tree/master/samples/hello) Simple Hello, world program, without division declarations.

[Hello Program](https://github.com/ajlopez/CobolScript/tree/master/samples/hellopgm) Hello, world program, with identification, environment, data and procedure divisions.

[Hello Web](https://github.com/ajlopez/CobolScript/tree/master/samples/helloweb) Hello web page. `display` output produces page content.

[Factorial](https://github.com/ajlopez/CobolScript/tree/master/samples/factorial) Factorial console program, using working storage variable, `perform` with `using` and `giving` and local variables for recursion.

[Factorial Web](https://github.com/ajlopez/CobolScript/tree/master/samples/factorialweb) Factorial web page.

[Local](https://github.com/ajlopez/CobolScript/tree/master/samples/local) Using `local` to define a variable, instead of working storage.

[Template](https://github.com/ajlopez/CobolScript/tree/master/samples/template) Console program using a template. CobolScript can be embedded in text.

[Template Web](https://github.com/ajlopez/CobolScript/tree/master/samples/templateweb) Web page using a template.

[Web Server](https://github.com/ajlopez/CobolScript/tree/master/samples/webserver) Accessing Node.js functions, to start a web server and serves a single page.

[Linkage Section](https://github.com/ajlopez/CobolScript/tree/master/samples/linkage) Using linkage section to access provided request, response in web page.

[Asynchronous Hello](https://github.com/ajlopez/CobolScript/tree/master/samples/helloasync) Perform and procedure using the new async reserved word.

## To do

- More Samples
- Web Site with templates and layout, get and post processing
- explicit `stop run`.
- `exit`, `exit perform`.
- File section.
- Pictures.
- `exec sql`.

## References

[COBOL Tutorial](http://www.mainframegurukul.com/tutorials/programming/cobol/cobol-tutorial.html)

## Contribution

Feel free to [file issues](https://github.com/ajlopez/CobolScript) and submit
[pull requests](https://github.com/ajlopez/CobolScript/pulls)  contributions are
welcome.

If you submit a pull request, please be sure to add or update corresponding<commit_msg>Adding MySQL sample to README<commit_after># 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:
```js
var cobolscript = require('cobolscript');
```

To compile a source code:
```js
var program = cobolscript.compileProgram('display "Hello, world".');
```

To compile a file:
```js
var program = cobolscript.compileProgramFile('./hello.cob');
```

To run a compiled program:
```js
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:
```js
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](https://github.com/ajlopez/CobolScript/tree/master/samples/hello) Simple Hello, world program, without division declarations.

[Hello Program](https://github.com/ajlopez/CobolScript/tree/master/samples/hellopgm) Hello, world program, with identification, environment, data and procedure divisions.

[Hello Web](https://github.com/ajlopez/CobolScript/tree/master/samples/helloweb) Hello web page. `display` output produces page content.

[Factorial](https://github.com/ajlopez/CobolScript/tree/master/samples/factorial) Factorial console program, using working storage variable, `perform` with `using` and `giving` and local variables for recursion.

[Factorial Web](https://github.com/ajlopez/CobolScript/tree/master/samples/factorialweb) Factorial web page.

[Local](https://github.com/ajlopez/CobolScript/tree/master/samples/local) Using `local` to define a variable, instead of working storage.

[Template](https://github.com/ajlopez/CobolScript/tree/master/samples/template) Console program using a template. CobolScript can be embedded in text.

[Template Web](https://github.com/ajlopez/CobolScript/tree/master/samples/templateweb) Web page using a template.

[Web Server](https://github.com/ajlopez/CobolScript/tree/master/samples/webserver) Accessing Node.js functions, to start a web server and serves a single page.

[Linkage Section](https://github.com/ajlopez/CobolScript/tree/master/samples/linkage) Using linkage section to access provided request, response in web page.

[Asynchronous Hello](https://github.com/ajlopez/CobolScript/tree/master/samples/helloasync) Perform and procedure using the new async reserved word.

[MySQL](https://github.com/ajlopez/CobolScript/tree/master/samples/mysql) Connecting and using a MySQL server.

## To do

- More Samples
- Web Site with templates and layout, get and post processing
- explicit `stop run`.
- `exit`, `exit perform`.
- File section.
- Pictures.
- `exec sql`.

## References

[COBOL Tutorial](http://www.mainframegurukul.com/tutorials/programming/cobol/cobol-tutorial.html)

## Contribution

Feel free to [file issues](https://github.com/ajlopez/CobolScript) and submit
[pull requests](https://github.com/ajlopez/CobolScript/pulls)  contributions are
welcome.

If you submit a pull request, please be sure to add or update corresponding
{'fraction_non_alphanumeric': 0.12341389728096677, 'fraction_numerical': 0.0012084592145015106, 'mean_word_length': 5.193638914873714, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 27, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2385004', 'n_tokens_mistral': 2056, 'n_tokens_neox': 1982, 'n_words': 578}