Skip to content

Language

Marcos Cobeña Morián edited this page Jan 10, 2019 · 8 revisions

The entire language's based on the one showcased in Computational Models and Complexity, from the Computer Science and Artificial Intelligence Department at the University of Seville, more specifically the Topic 1: Computational models or Topic 1: Computable algorithms and functions.

Vars

Input: X (or X1), X2, X3, ..., X8; provided at startup

Output: Y

Aux.: Z (or Z1), Z2, Z3, ..., Z8

All of them:

  • are set to 0 by default; and
  • work on [0, Int32.MaxValue], thus negative numbers aren't allowed by definition

Labels

A1 (or A), B1 (or B), C1 (or C), D1 (or D), E1 (or E), A2, B2, C2, D2, E2, ..., A8, B8, C8, D8, E8

E (or E1) is a special one, as it's used for exiting.

Instructions

For each var V and label L:

  • Increment: V = V + 1
  • Decrement: V = V - 1
  • Conditional: IF V != 0 GOTO L
  • Skip: V = V
  • [K] Instruction
    • being K a label different from E, and
    • Instruction any of the above

Comments

Every string starting with semicolon ; and ending with carriage return \n is considered a comment.

Comments can be used in a whole line

; like this one

or, at the end of any other one

Y = Y + 1 ; like this other one

Programs

Any finite succession of instructions whose last one isn't Y = Y.

Macros

A macro is a program which makes a specific task. Programs can define macros at the top —i.e. prior using them. While a program's been compiled its macros are expanded (replaced) conforming a single program composed of above instructions.

Macros' instructions are defined in the following way:

MACRO signature
body
END

, where:

  • signature refers to a word followed by parameters,
    • parameters to ids which can represent vars or labels; and
  • body to a program as defined above, with the exception of using signature parameters instead of valid vars and labels
MACRO GOTO L
Z = Z + 1
IF Z != 0 GOTO L
END

GOTO E

Example of GOTO L macro: when used at bottom, L param's replaced for the valid E label

Clone this wiki locally