Elna programming language compiles simple mathematical operations to RISC-V code.
Go to file
2024-04-10 22:43:12 +02:00
backend Parse reference and dereference operators 2024-04-10 22:43:12 +02:00
cli Tokenize the input with flex 2024-04-06 16:10:07 +02:00
include Parse reference and dereference operators 2024-04-10 22:43:12 +02:00
shell Split code generation from the ui 2024-03-07 09:15:11 +01:00
source Parse reference and dereference operators 2024-04-10 22:43:12 +02:00
tests Tokenize the input with flex 2024-04-06 16:10:07 +02:00
.gitignore Extend the tester to compile sources 2024-02-25 15:16:19 +01:00
CMakeLists.txt Tokenize the input with flex 2024-04-06 16:10:07 +02:00
README Extend the tester to compile sources 2024-02-25 15:16:19 +01:00
TODO Parse pointer types 2024-04-07 23:39:56 +02:00

# Elna programming language

Elna compiles simple mathematical operations to machine code.
The compiled program returns the result of the operation.

## File extension

.elna

## Grammar PL/0

program = block "." ;

block = [ "const" ident "=" number {"," ident "=" number} ";"]
        [ "var" ident {"," ident} ";"]
        { "procedure" ident ";" block ";" } statement ;

statement = [ ident ":=" expression | "call" ident 
              | "?" ident | "!" expression 
              | "begin" statement {";" statement } "end" 
              | "if" condition "then" statement 
              | "while" condition "do" statement ];

condition = "odd" expression |
            expression ("="|"#"|"<"|"<="|">"|">=") expression ;

expression = [ "+"|"-"] term { ("+"|"-") term};

term = factor {("*"|"/") factor};

factor = ident | number | "(" expression ")";

## Operations

"!" - Write a line.
"?" - Read user input.
"odd" - The only function, returns whether a number is odd.