Nemo (programming language)

Nemo is an interpreted, general-purpose, high-level programming language.

It is named after Captain Nemo as seen in Twenty Thousand Leagues Under the Sea by Jules Verne

Syntax

Hello, world

The most basic program in Nemo (and probably any other language out there) - hello world - looks like this:

print("hello, world\n");

One of Nemo's features is that there is really no need for parenthesis in a function call. That said, the above could look like this:

print "hello, world\n";

Comments

Nemo supports two types of comments.

One line

# I'm a comment

Multi line

/*
 * I'm a multiline comment
 */

Data types

Int

For now the only supported ints are in base of 10, and are what you would expect an int to be.

2
42

Float

2.71
3.14
2.   # equivalent to 2.0
.5   # equivalent to 0.5

String

As you could see in the Hello, world example, there are strings. Note: there is no support for Unicode.

"hello, world"
"AHOY\rhello\n"

Array

[]
[1, 2, 3, 4]

Note: Array elements can be of any type.

[1, 1.4, "hello"]

Bool

There really is no "bool" type. The things that are considered "false" in Nemo are: integer 0, floating-point 0.0, an empty string ("") and an empty array ([]).

Control structures

One of the things that distinguishes Nemo from other languages are the control structures. Most languages define them as such:

if/while (<expr>) <stmt>

Whereas in Nemo it goes like this:

if/while <stmt> <stmt>

The second statement gets executed when the first statement evaluates as "true". Note: apart from if and while there are also unless and until structures.