Elna programming language compiles simple mathematical operations to RISC-V code.
Go to file
2022-06-13 17:46:02 +02:00
source Save ELF symbols in a hash table 2022-06-13 17:46:02 +02:00
tests Implement a RISC-V backend 2022-06-11 00:38:03 +02:00
.gitignore Initial commit 2022-06-05 15:16:04 +02:00
dub.json Initial commit 2022-06-05 15:16:04 +02:00
Rakefile Write an IR visitor 2022-06-12 23:48:50 +02:00
README Initial commit 2022-06-05 15:16:04 +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.