Skip to content

Fastering18/node-gblok

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GBLK language written in Node.js

gblk-icon

travisci-test npm-download npm-versi Website

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

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 <filepath>

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
Register an account, publish packages


Maintained by Fastering18
Discord  |  Github