Lunarisnia / bejat

Bejat Programming Language for the (not) sane people out there

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


Bejat Programming Language

Bejat is an open source programming language that makes it hard to build simple, unreliable, and absolutely not efficient software with style.



Table of Contents

How to Use

  1. Download the latest interpreter from the release page
  2. Create a text file with the name test.bejat
  3. Add the following line to the file
    `panggilin bilang pake "Hello, World"
  4. ./bejat test.bejat

Documentation

Data Types

Bejat is a strongly typed language with no support for type casting because I don't know how to implement type casting.

  • String: tulisan
  • Boolean: bulen
  • Number: nomor
  • Null: It doesn't exist, I am too lazy to implement it.

Variable

Creating a New Variable

"Hello" ini tulisan nya foo
^           ^           ^
Data        Data Type   Variable Name

Reassigning a Variable

"World" ini gantinya foo
^                    ^
Data                 Variable Name

Operator

Arithmathic Operators

  • Addition: ditambah
  • Subtraction: dikurang
  • Multiplication: dikali
  • Division: dibagi
  • Modulo: sisa bagi

Comparison Operators

  • Equal: sama ama
  • Not Equal: ga sama ama
  • Greater Than: lebih dari
  • Greater Than or Equal to: lebih ato sama ama
  • Less Than: kurang dari
  • Less Than or Equal to: kurang ato sama ama

Logical Operators

I honestly forgot to implement this so I am not gonna bother.

Function

Calling a Function

panggilin bilang pake "Hello, World"
^         ^           ^
Keyword   Func Name   Data

Defining a Function

There is none... sorry, it's just that when I allow you guys to define your own function I have to deal with variable scope and oh my god what a complex problem to solve, or that I am just too dumb. Which is probably the latter but you can technically make your own function. If you scour my badly written code in this repository you can find how I parse my language and write your own standard library function directly.

Flow Control

If

kalo a sama ama 20 {
    panggilin bilang pake "TRUEEEEE"
}

Else If

kalo a sama ama 20 {
    panggilin bilang pake "TRUEEEEE"
} kalo ga a lebih dari 9999 {
    panggilin bilang pake "elif"
}

Else

kalo a sama ama 20 {
    panggilin bilang pake "TRUEEEEE"
} kalo ga a lebih dari 9999 {
    panggilin bilang pake "elif"
} yaudah {
    panggilin bilang pake "ELSE"
}

How to Run

Really? why would you want to compile this? No. Why would you want to download this in the first place? are you okay? Maybe you need to talk to a helpline? https://www.helpguide.org/find-help.htm

But it's actually quite simple

  1. Clone this repository
  2. pip install -r requirements.txt
  3. Make sure you got antlr4 installed on your system if not then pip install antlr4-tools
  4. run ./generate_grammar.sh
  5. python3 ./main.py ./step_test.bejat

Python 3.12+

And also I reccomend doing everything inside a virtual environment.

How to Contribute

Thank you for even reading this far into the README.md but honestly I don't think this project is worth contributing. Thank you again..

About

Bejat Programming Language for the (not) sane people out there


Languages

Language:Python 91.8%Language:ANTLR 7.1%Language:Shell 0.6%Language:HTML 0.5%