DreamScript
DreamScript is an OpenSource superset of JavaScript that compiles to clean JavaScript output.
[![License](https://img.shields.io/badge/License-MIT-blue.svg)
![NPM](https://nodei.co/npm/dreamscript.png)
DS Installation
- Install NodeJs
- Open your Console
- Install globally using NPM
npm install -g dreamscript
npm install --save dreamscript
npx dreamscript
Put the dreamscript.exe in C:\Users\ASUS\AppData\Roaming\npm
Get Started
~$ dreamscript run <your file or directory file>
atau
~$ dreamscript cmp <your file or directory file>
atau
for any command, you can see at:
~$ dreamscript -h
Example
.
├── code
└── lib
├── index.ds
└── code.ds
$ dreamscript dir code lib
this command will compile all files in the lib
folder and write the compilation results to the code
folder with the same name and the extension js
.
├── code
│ ├── index.js
│ └── code.js
└── lib
├── index.ds
└── code.ds
Example Compile
const ds = require("dreamscript");
var code = `
func ds(){
write("hello, world");
}
ds();
`;
ds.compile(code).then(compiled => {
console.log(compiled);
});
Example Run
const ds = require("dreamscript");
var code = `
func ds(){
write("hello, world");
}
ds();
`;
;(async () => {
await ds.run(code)
});
Difference Syntax
DreamScript | JavaScript |
---|
func() | function() |
write() | console.log() |
type{} | class{} |
struct() | constructor() |
CREDITS