https://github.com/fastering18/node-gblok
GBLK code interpreter written in node.js
https://github.com/fastering18/node-gblok
bahasa indonesia indonesian-language interpreter javascript language nodejs
Last synced: about 1 year ago
JSON representation
GBLK code interpreter written in node.js
- Host: GitHub
- URL: https://github.com/fastering18/node-gblok
- Owner: Fastering18
- Created: 2021-07-05T13:36:45.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-21T19:09:50.000Z (over 3 years ago)
- Last Synced: 2024-04-25T19:20:59.261Z (about 2 years ago)
- Topics: bahasa, indonesia, indonesian-language, interpreter, javascript, language, nodejs
- Language: JavaScript
- Homepage:
- Size: 12.8 MB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
GBLK language written in Node.js
GBLK language is interpreted language written in node.js
Get started | Homepage | Online interpreter
> **🚨 We're currently working on gblk edition-2 as compiled language!
> join our discord server for more information.**
Examples
#1 Fibonacci function
Recursive fibonacci function written in GBLK
lokal fibbonaci = fungsi(x)
jika x < 2 maka
kembali 1;
jikatidak
kembali fibbonaci(x-2) + fibbonaci(x-1);
tutup
tutup
print(fibbonaci(7)) -- 21
#2 Pyramid function
Terminal output text shape with loops
lokal piramid = fungsi(r)
jika r < 3 maka kembali "row must higher than 2" tutup
lokal hasil = ""
untuk i = 0 ke r lakukan
hasil = hasil + (" " * (r - i)) + ("* " * (i)) + "\n"
tutup
kembali hasil
tutup
print(piramid(10))
#3 Dynamic objects
A node.js-like objects
lokal obj = {
"sus": benar,
nama: "amogus",
isSus: fungsi() -> benar,
suspect: ["red", "white"]
}
print(obj -> suspect -> 1)
print(obj -> suspect -> 2)
print(obj -> nama)
print(obj)
## API
```js
const gblk = require("node-gblk")
const skrip = `print("Hello world")`
gblk
.runTerminal(skrip, "./indeks.gblk")
.then(console.log)
```
## CLI Usage
Install package as global `npm i -g node-gblk`
Run command `gblok run `
`gblok`: command to run files
> - **gblok help** Show list commands
> - **gblok run index.gblk** Run gblk file
> - **gblok repl** Run gblk in REPL mode (directly compile in stdin)
`gpm`: command to install and manage packages
> - **gpm help** Show list commands
> - **gpm init** Initialize sample project folder
> - **gpm login** Login to our package manager
> - **gpm install module:versi** Install module with specified version
> - **gpm publish** Publish module to our package manager
> **Make sure to install this package globally to use CLI commands**
## Package Manager (beta)
[https://gbpm.fastering181.repl.co](https://gbpm.fastering181.repl.co)
Register an account, publish packages
Maintained by Fastering18
[Discord](https://discord.gg/FHVjsSg7jU) | [Github](https://github.com/Fastering18)