# deep-coder-codegen

> deep-coder code generator from DSL program

Latest version **1.0.8** (published 2019-01-28) · 0 weekly downloads

## Install

```sh
npm install deep-coder-codegen
pnpm add deep-coder-codegen
yarn add deep-coder-codegen
bun add deep-coder-codegen
```

Provides the command `deep-coder-codegen`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2019-01-28 |
| First published | 2019-01-28 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 35.5 KB |
| Known vulnerabilities | 0 (+8 in 2 direct dependencies) |
| Install scripts | no |
| Author | Dinh Cuong, Duong |
| Maintainers | cuongquay |
| Keywords | deep-coder, codegen |

## Links

- npm: https://www.npmjs.com/package/deep-coder-codegen
- npm.io page: https://npm.io/package/deep-coder-codegen

## Dependencies (7)

- [uuid](https://npm.io/package/uuid.md) ^3.1.0
- [yargs](https://npm.io/package/yargs.md) ^11.0.0
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [rimraf](https://npm.io/package/rimraf.md) ^2.6.2
- [adm-zip](https://npm.io/package/adm-zip.md) ^0.4.7
- [hogan.js](https://npm.io/package/hogan.js.md) ^3.0.2
- [reftools](https://npm.io/package/reftools.md) 0.0.20

## Recent versions

- 1.0.8 (latest) — 2019-01-28

## README

Generate NodeJS program from DSL
---

When you're done with DSL code generation, you can use this tool to generate the NodeJS program with TypeScript.


## Install CLI tool

This is a prebuilt program let you install into your machine as a command line internface:

```shellscript
$ npm install -g deep-coder-codegen
```

## Generate Code

Next, you need to prepare a sample test file.

***Sample test file: `samples/sample.dot.json`***

```javascript

[
{"input":[[1,3,-5],[-2,4,1]],"output":5},
{"input":[[1,2,3,4,5],[1,0,1,0,1]],"output":9},
{"input":[[-6,5,-4,1,-8],[-8,4,-6,10,4]],"output":70},
{"input":[[9,-3,2],[3,-6,3]],"output":51},
{"input":[[1],[1]],"output":1}
]

```

***Generage a program using deep-coder***

```shellscript
$ docker run -it -v $(PWD)/samples:/tmp/ cuongdd1/deep-coder ./generate.sh /tmp/sample.dot.json > program.dot.dsl
```

***Example DSL file: `program.dot.dsl`***

```deep-coder DSL

---
a <- read_list
b <- read_list
c <- sum b
d <- zip_with * b a
e <- sum d
---

```

***Run the generator command line with arguments:***

```shellscript
$ deep-coder-codegen -o my-app program.dot.dsl samples/sample.dot.json
```

***Test the generated nodejs application ***

```shellscript
$ cd my-app && npm install && npm test

> deep-coder-autogen@0.1.2 test /Users/cuongdd1/deep-coder-codegen/runable
> node es6run.js

Sample:  { input: [ [ 1, 3, -5 ], [ -2, 4, 1 ] ], output: 5 }
 - Result: 5 - Output: 5
Sample:  { input: [ [ 1, 2, 3, 4, 5 ], [ 1, 0, 1, 0, 1 ] ], output: 9 }
 - Result: 9 - Output: 9
Sample:  { input: [ [ -6, 5, -4, 1, -8 ], [ -8, 4, -6, 10, 4 ] ],
  output: 70 }
 - Result: 70 - Output: 70
Sample:  { input: [ [ 9, -3, 2 ], [ 3, -6, 3 ] ], output: 51 }
 - Result: 51 - Output: 51
Sample:  { input: [ [ 1 ], [ 1 ] ], output: 1 }
 - Result: 1 - Output: 1

```

---
_Source: https://npm.io/package/deep-coder-codegen · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
