Noida

From Esolang
Jump to navigation Jump to search

Noida is a lame and simple esolang created by User:Saka. It is designed to be simple and easy to write an interpreter for.

Noida is short for "No idea" because I didn't know what to name it.

Basics

In Noida, values are stored in variables. These values can be a string ([My String]) or an int (.3141).
Variables can be accessed using a dollar sign ($MyVar). Variable names cannot contain spaces.
Each instruction must be on it's own line and lines starting with # are comments. Instructions are of the form:

Intruction : Argument1 : Argument2 : etc.

Noida uses curly brackets ({}) as code blocks.

Instructions

Instructions

Instruction Description
new : s New variable s (String).
set : v : a Set v (Variable) to a (Any).
print : a Print a (Any).
input : dt : v Input to v (Variable) as dt (str/int).
if : c If c (Condition/Boolean; see below) execute the code block below.
repeat Repeat the code block.
done Terminate the program.

Booleans

Condition Description
same a b True if a = b, False otherwise.
greater a b True if a is greater than b, False otherwise.

Misc.

Instruction Description
math a o b* Return integer a +;-;*;/ b.
join a b c d...* Join strings a, b, c, d,...

*There can be no math operations inside math operations and no join operations in join operations.

Examples

Hello, World!

print : [Hello, World!]

Truth Machine

new : i
input : int : $i
if : same $i .0
{
	print : .0
	done
}
if : same $i .1
{
	print : .1
	repeat
}

CAT

new : i
input : str : $i
print : $i

Nil

#The computer will always win.
new : n
new : i
new : c
set : $n : .12
print : [It's a fine day to play a game of Nil.]
print : [You go first, carbonface.]
{
    input : int : $i
    if : greater $i .3
    {
        print : [You cheater...]
        print : [You can't fool me with your strange inputs!]
        done
    }
    if : greater .1 $i
    {
        print : [You cheater...]
        print : [You can't fool me with your strange inputs!]
        done
    }
    set : $n : math $n - $i
    set : $c : math .4 - $i
    set : $n : math $n - $c
    print : [I'll take...]
    print : math .4 - $i
    print : [Current left:]
    print : $n
    if : same $n .0
    {
        print : [Boom I won!]
        done
    }
    repeat
}

Interpreter

Python

Available on GitHub