From be4957ee599e7e14c934e61f3d91354760b38acd Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sun, 21 Jul 2024 16:15:17 +0200 Subject: Initial commit --- README | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 README (limited to 'README') diff --git a/README b/README new file mode 100644 index 0000000..b6e03eb --- /dev/null +++ b/README @@ -0,0 +1,37 @@ +# 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. -- cgit v1.2.3