jabezborja / tagalang

A high-level tagalog-based syntax procedural programming language.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TagaLang - A Tagalog Programming Language

TagaLang is a rooftop-level Tagalog-based syntax yet-procedural cautiously interpreted programming language that Filipino programmers can play with.

It is on top of Python, a high-level language, so TagaLang is considered the 'rooftop-level' programming language. Its design is for readability and for Filipinos to understand how programming languages work in their native language. With that being said, I will try my best to make the grammar more Tagalog.

The reason why TagaLang is made from scratch is to make the language allow more grammar to use and more easy to read as it will use more Filipino grammar (Hopefully it can.)

Example

@ TagaLang
baryabol operation_1 ay 2 + 5 * 5
baryabol operation_2 ay 3

@ Will print 30, TagaLang accurately follow the MDAS math.
ipahayag ang operation_1 + operation_2

Equivalent to

# Python
operation_1 = 2 + 5 * 5
operation_2 = 3

# Will print 30, Python accurately follow the MDAS math.
print(operation_1 + operation_2)

Todos

  • Lexer
  • Parser
    • Parse Tree (AST)
  • Baryabols
    • AST Node
    • Assign
    • Access
    • Types
  • Builtins
    • Ipahayag (print function)
      • AST Node
      • Interpreter Visitor
    • Itala (input function) Currently on my stash
      • AST Node
      • Interpreter Visitor
  • Kung-Ibapa statements (If-else statements)
    • Kung (If)
    • Ibapa (Else if)
    • Iba (Else)
  • Tukuyin (Functions)
  • Bawat loops (For loops)
  • Habang loops (While loops)

Installation

Prerequisites

  • Python3.x

Clone the TagaLang repository in your local machine to get started. (TagaLang is not in Pip yet.)

git clone git@github.com:jabezborja/TagaLang.git

After that, you can now start coding with TagaLang.

But first, go to interpreter folder.

In windows:

cd interpreter

Then

Try to run the file you want.

py pin.py <file-name>

To test it out, run the program.tag first

py pin.py program.tag

And it should interpret the program.

How To Use

There is no Functions, and loops yet.

Variables

Variables in TagaLang are called Baryabols (well, because it is Tagalog). Types in TagaLang are not different in other languages, just the syntax.

String -> letra
Integer -> numero
Boolean -> ano
Array -> hanay
None or Null -> Wala
Any -> kahitano

You can declare a variable with just this:

baryabol name ay "Nice"

To test it out, you can print it with ipahayag.

Ipahayag

Ipahayag is like print() in Python. Just simple.

To print a string or letra

ipahayag ang "Nice"

To print a variable

ipahayag ang variable_name

or

ipahayag ang "Ako si " + name

Kung Statements

Just like other languages, we have Kung statements too.

Kung statements works like Lua programming with 'THEN' and 'END'

But in TagaLang, it is 'TAPOS' and 'PAGTATAPOS'

To perform a kung statements

kung <condition> tapos
    ...
pagtatapos

Just basic as that. Let's try to make something with 'Kung Statements'

baryabol pangalan ay "Jabez"

kung pangalan ay "Jabez" tapos
    ipahayag ang "Kumusta, Jabez!"
pagtatapos

And it works like a charm. You can try it yourself!

Tukuyin Functions

Tukuyin is inspired by Python's 'def' which is derived from the word 'define'. And just like Python, it almost has the same function structure but TagaLang does not depend on indentation, but in 'TAPOS' and 'PAGTATAPOS' like Kung statements.

To establish a new function:

tukuyin ang <function_name>(<parameters>) tapos
    ...
pagtatapos

To call it, simply:

<function_name>(<parameters>)

Now, let's try to make program out of it.

baryabol name ay "Jabez"

tukuyin ang main() tapos
    kung name ay "Jabez" tapos
        ipahayag ang "Kumusta, Jabez!"
    pagtatapos
pagtatapos

main()

Which equivalent to, in Python:

name = "Jabez"

def main():
    if name == "Jabez":
        print("Kumusta, Jabez!")

main()

Changelog

Oct 8, 2021

  • Kung statements (If statements)
  • Tukuyin (Functions)

Oct 5, 2021

  • Ipahayag (print)
  • Itala (input)
  • Better exceptions
  • Code docs

Oct 2, 2021

  • Redesign the language

Oct 1, 2021

  • Baryabol callers (They can now call each other)
  • Better errors
  • Ready the Repo template structure for PyPi submission
  • Process timer

Sept 30, 2021

  • Rewrote the entire language
  • Lexer
  • Parser
  • Baryabols (Variables)
  • Baryabols types (Letra (string), Numero (integer), Ano (Boolean), KahitAno (Any))

Sept 28, 2021

  • Recontinue of the Project as TagaLang

Sept, 2020

  • Start of the Project as TagaLag
  • No Lexers or Parsers, just poor old creaky language. Scanning method.

About

A high-level tagalog-based syntax procedural programming language.

License:MIT License


Languages

Language:Python 100.0%