We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Eremias 2

From Esolang
Jump to navigation Jump to search

Eremias 2 is an interpreted, dynamically typed esoteric programming language in which all created variables are shared between all cores and command execution flow is directed by goto. Developed first as an idea during a field trip where Eremias arguta lizards were common, then as several non-published attempts to implement it.

Syntax

The syntax of the language is inspired by BASIC and C, although most of the similarities came from importance of goto in the language. Originally the syntax was supposed to be similar to that of Python, but the use of goto eliminated the need in indentation. The model for any line in Eremias 2 would look like this: <hex>[.<alias>] [<condition> ? ]<expression>[ : <alternative>] Blocks in [] are optional, the table below describes every element of the line.

Element Element function Example
<hex> Hexadecimal line number 0f
<alias> Line alias, can be referenced in goto as a string start
<condition> Line condition. When True, triggers the expression, otherwise the alternative is triggered if present n<100
<expression> Main body of the line, must be present on any Eremais 2 line, may contain ; to fit several actions per line print n; goto "start"
<alternative> The alternative to the expression, may be omitted goto 0

Lines may contain comments, which can be placed between an $ and the end of the line.

Data types

Eremias 2 supports regular Python data types as well as lists, arrays and high-precision Decimal floating point numbers. To explicitly set a type to a constant, a type prefix should be used: 10 a = dec.1.5

Basic operations

List of supported operations:

  • ' - posession operator, first = my_list[0] would look like first = my_list'0 in Eremias
  • ^ - power operator
  • *
  • //
  • /
  • %
  • +
  • -
  • ==
  • && - and operator
  • !=
  • >
  • <
  • || - or operator

As well as ++ and -- for variables.

Functions

While in many languages usage of built-in functions requires parenthesis after the function itself, Eremias 2 only requires a single whitespace after the function name. To separate nested functions, parenthesis around the inner function(s) are used instead. The actual list of supported operations can be found in er2.py linearize function. Most notable ones would be convert, goto and warp. The first function of the three eliminates the need in separate type conversion functions, as it converts its first input argument into the type of the second input argument. goto accepts both integers and strings. Note, that line numbers in the language are not decimal, therefore to reference a hex number, you must put a sharp before it. Example: 10 goto #10. Warp is similar to goto, but instead of shifting the current worker’s focus to a different line, it creates a new worker, which starts execution at the specified line.

Interpreter

The interpreter is split into two files: - er2.py, the core engine of Eremias needed for bytecode generation and its execution - er2gui.py, the development environment, needed to spawn the master process to manage io as well as worker interactions.

The interpreter can only be launched via the development environment, which is a tkinter-based console with features such as input history, color highlighting and file editing. Eremias 2 DE commands:

Command Function
all Lists all .ems files in current working directory and its subfolders
run Launches a valid Eremias 2 file. Example: run fizzbuzz.ems
compile Processes the specified file and outputs generated bytecode in the console
read Displays the content of the specified text file
edit Clears the screen and fills it with specified text file’s content
new Clears the screen and unlocks the Text widget to be used as a text editor
save Saves console’s content as a file with specified filename
clear Clears the screen

Interpreter specifics

  • requires Python 3.10 and higher with numpy installed, pypy is supported, but performs worse than cpython
  • requires Fixedsys font for the DE
  • requires your Python to have tkinter
  • list members are immutable, which is due to Manager limitations, to counter this, the sub function was implemented
  • f-string functionality is present in Eremias 2, 10 print ("My name is \i!" / "Eremias") would print “My name is Eremias!”
  • undeclared variables always contain a zero
  • exceptions cannot be handled from within Eremias 2
  • the DE contains two widgets, the Text on top and an Entry on the bottom, both are black, so to switch to the Entry you should click on the area near the bottom of the window
  • the Development Environment can switch between fullscreen and windowed mode via the Escape key
  • negative constants are not yet supported (see Examples)

Examples

Hello, world!

10 print ("Hello, world!")

FizzBuzz

0f n = 0; goto 16
10 n > 100 ? goto 0 : n++
20 n%15 == 0 ? goto #60
30 n%5 == 0 ? goto #70
40 n%3 == 0 ? goto #80
50 print n; goto #10
60 print "FizzBuzz"; goto #10
70 print "Buzz"; goto #10
80 print "Fizz"; goto #10

Fibonacci sequence

10 fib = [0,1]
11 i1 = 0-1; i2 = 0-2
12 100 > (len fib) ? goto #20 : goto #30
20 fib = append fib, (fib'i1+fib'i2); goto #12
30 n = 0
40 n == (len fib) ? goto 0 : print (fib'n); n++; goto #40

Cat

10 print (input "")

Infinite loop

10 goto #10

External resources