My small language written in C.
Find a file
2022-04-20 20:10:17 +02:00
examples initial commit 2022-04-20 20:10:00 +02:00
src initial commit 2022-04-20 20:10:00 +02:00
.gitignore initial commit 2022-04-20 20:10:00 +02:00
Makefile initial commit 2022-04-20 20:10:00 +02:00
README.md initial commit 2022-04-20 20:10:00 +02:00

Simple BASIC language implementation

The goal of this project is to create a simple implementation of a BASIC-like language. No need to do complex thing, just to create a simple interpreted language that can be used to do some arithmetics and create for ex a number guessing game.

Technology

We will create our own regex engine

Syntax

One instruction set per line

Instruction sets avalaibles:

Commentary

can only use single line comments with #

# this is a comment

Expression evaluation

can only operate on integer

function calls: func(arg_a, arg_b) operators: +, *, / booleans operators: not, and, or,

function definition

function {NAME}
begin
...
end

Set a variable

set {VARNAME} to {EXPRESSION}

Conditional structure

if {EXPRESSION} then
begin
    ...
end

Conditional loop

while {EXPRESSION} do
begin
    ...
end

Unconditional loop

repeat {EXPRESSION THAT EVALUATE TO INT}
begin

end

std functions

put_stdout()
take_stdin()
int_of_string()
random_int(min, max)