My programming language named JoLang. (Mainly created for fun)

Related tags

Miscellaneous JoLang
Overview

JoLang

status: not ready

So this is my programming language which I decided to name 'JoLang' (inspired by Jonathan and GoLang).

Features I implemented so far:

  • shell (REPL)
  • Comments
  • macros
  • operators
  • variables
  • functions (only at AST level )
  • function calls (only at AST level)
  • if statements (only at AST level)
  • loops (while and for) (only at AST level)

Currently, I am working on the parser and AST and between task to task, i add features to the shell. I haven't implemented an interpreter yet, but the shell.

Docs:

comments:

You can write a comment with the $ prefix. a comment ends at the end of the line. example:

$ some comment
$ another comment

macros:

%macro any_identifier replace_with

What does a macro do? every time that the preprocessor sees an instance of any_identifier, it immediately replaces it with replace_with. Note that any_identifier must be an identifier. For example: %macro 0 1 would not work, but %macro zero 1, would.

Example:

%macro hello "hello"

hello + "world"

the parser would not see the macro at all, but just "hello" + "world".

operators:

for example: ~v, !v (negate v), +v, -v, v1+v2, v1 % v2. The precedence of the operators is the same as in Python (Except !,+, -, ~ which have the highest precedence after ()).

variables:

variables are set like that:

variable = any_expression

note that assignment is considered an expression and not an assignment, so it's possible to do stuff like (a = 2) and also (a = b = c = 2) and even inplace operators (a += b -= c = 2) which will assign 2 to c and then subtract-assign c (2) from b, and then add-assign it back to a.

functions:

you can define a function by the following syntax:

func thing(arg1, arg2){
 $ statements
}

Note that there are no keyword-arguments.

function calls:

You can "call" any expression, ()(), 4(), (3 + 4)(3) "hello"(), etc.

But an error would be raised if a special __call__-like method was not defined.

if statements

You can define an if statements by this syntax: if(expression){body}. you can also add elif(expr){body} and else{body} blocks.

example:

if(a = thing()){
    do_with(a) $ a is the result of thing()
}
elif(a = another_thing()){
}
else {
}

loops

There are two types of loops, a for loop and a while loop. the while loop is written like while(cond){body} and the for loop is written like for(expr;expr;expr){body} where expr can be nothing (like (;;)). in case the for loop is defined as (;;) it would be equivalent to while(true).

examples:

while:

while(name = getname()){
    do_with(name)
}

for:

for(i=0;i<10;i += 1){ $ there is no i++ in jolang (yet)
    do_with(i)
}
You might also like...
Wordle is fun, so let's ruin it with computers.

ruin-wordle Wordle is fun, so let's ruin it with computers. Metrics This repository assesses two metrics about each algorithm: Success: how many of th

Moji sends text and fun facts from different APIs wit da use of a notification deamon
Moji sends text and fun facts from different APIs wit da use of a notification deamon

Moji sends text and fun facts from different APIs wit da use of a notification deamon. Can be runned via dmenu or rofi.

Just messing around with AI for fun coding 😂

Python-AI Projects 🤖 World Clock ⏰ ⚙︎ Steps to run world-clock.py file Download and open the file in your Python IDE. Run the file a type the name of

Funchacks - Fun module which is a small set of utilities
Funchacks - Fun module which is a small set of utilities

funchacks 👋 Introduction Funchacks is a fun module that provides a small packag

Its a simple and fun to use application. You can make your own quizes and send the lik of the quiz to your friends.
Its a simple and fun to use application. You can make your own quizes and send the lik of the quiz to your friends.

Quiz Application Its a simple and fun to use application. You can make your own quizes and send the lik of the quiz to your friends. When they would a

Short, introductory guide for the Python programming language
Short, introductory guide for the Python programming language

100 Page Python Intro This book is a short, introductory guide for the Python programming language.

sawa (ꦱꦮ) is an open source programming language, an interpreter to be precise, where you can write python code using javanese character.
sawa (ꦱꦮ) is an open source programming language, an interpreter to be precise, where you can write python code using javanese character.

ꦱꦮ sawa (ꦱꦮ) is an open source programming language, an interpreter to be precise, where you can write python code using javanese character. sawa iku

The Zig programming language, packaged for PyPI

Zig PyPI distribution This repository contains the script used to repackage the releases of the Zig programming language as Python binary wheels. This

The Official interpreter for the Pix programming language.
The Official interpreter for the Pix programming language.

The official interpreter for the Pix programming language. Pix Pix is a programming language dedicated to readable syntax and usability Q) Is Pix the

Owner
Jonathan
Jonathan, just a typical Python programmer.
Jonathan
Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like.

Advent Of Code 2021 - Python English Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels th

Coral Izquierdo Muñiz 2 Jan 9, 2022
Rick Astley Language is a rick roll oriented, dynamic, strong, esoteric programming language.

Rick Roll Language / Rick Astley Language A rick roll oriented, dynamic, strong, esoteric programming language. Prolegomenon The reasons that I made t

Rick Roll Programming Language 658 Jan 9, 2023
PyGo custom language, New but similar language programming

New but similar language programming. Now we are capable to program in a very similar language to Python but at the same time get the efficiency of Go.

Fernando Perez 4 Nov 19, 2022
A Python simple Dice Simulator just for fun

Dice Simulator ?? A Simple Python Dice Simulator ?? ?? ?? Description: That program make your RPG session more easy and simple. Roll the dice never be

Lauro Brant 17 May 14, 2022
a simple thing that i made for fun :trollface:

we-do-a-little-trolling about a simple thing that i made for fun. requirements and instructions first you need to install obs , then start the virtual

ranon rat 6 Jul 15, 2022
1cak - An Indonesian web that provide lot of fun.

An unofficial API of 1cak.com 1cak - An Indonesian web that provide lot of fun. Endpoint Lol -> 10 Recent stored posts on database Example: https://on

Dicky Mulia Fiqri 5 Sep 27, 2022
Secret santa is a fun and easy way to get together with your friends and/or family with a gift for them.

Secret Santa What is Secret Santa? Secret santa is a fun and easy way to get together with your friends and/or family with a gift for them. The idea i

null 2 Dec 6, 2021
A simple bot that will help you in your learning and make it more fun.

hyperskill-SimpleChattyBot-python A simple bot that will help you in your learning and make it more fun. Syntax bot.py Stages Stage #1: Zuhura Bot we

null 1 Nov 9, 2021
Really bad lisp implementation. Fun with pattern matching.

Lisp-py This is a horrible, ugly interpreter for a trivial lisp. Don't use it. It was written as an excuse to mess around with the new pattern matchin

Erik Derohanian 1 Nov 23, 2021
Make creating Excel XLSX files fun again

Poi: Make creating Excel XLSX files fun again. Poi helps you write Excel sheet in a declarative way, ensuring you have a better Excel writing experien

Ryan Wang 11 Apr 1, 2022