Interprete del lenguaje HULK escrito en C# en .NET7.0 , Windows10. Para ejecutarlo:
dotnet run --project Interpreter.Visual\Interpreter.Visual.csproj
Para informaciones generales del lenguaje ver Informe.tex y generar el pdf. Gracias!
program : statement_list
statement_list : compounds
statement : declarations
| assignment
| conditionals
| functions
| call_functions
| print
| compounds
declarations : LET + ID (COMMA ID)* + EQUAL + compounds + IN + compounds
assignment : ID + ASSIGN + compounds
conditionals : IF + L_PARENT + compounds + R_PARENT (RETURN)* + compounds + ELSE (RETURN)*+ compounds
functions :FUNCTIONS + ID + L_PARENT + ID (COMMA ID)* + R_PARENT + RETURN + compounds
call_functions: L_PARENT + compounds (COMMA compounds)* + R_PARENT
print: PRINT + L_PARENT + compounds + R_PARENT
compounds : comp + ((AND | OR) comp)*
comp : expr + ((SAME | DIFFERENT | LESS | GREATER | LESS_EQUAL | GREATER_EQUAL | NOT ) expr)*
expr : term + ((PLUS | MINUS | AT ) term)*
term : exp + ((MUL | DIV | MOD) exp)*
exp: factor + ((POW) factor)*
factor :statement
| PLUS factor
| MINUS factor
| NUMBER
| STRING
| BOOLEAN
| PI
| ID
| TRUE
| FALSE
| L_PARENT compounds R_PARENT
type_data :
NUMBER
| BOOL
| STRING
- [OK] PLUS (+)
- [OK] MINUS (-)
- [OK] MULT (*)
- [OK] MOD (%)
- [OK] FLOAT_DIV (/)
- [OK] ASSIGN (=)
- [OK] SAME (==)
- [OK] DIFFERENT (!=)
- [OK] LESS (<)
- [OK] GREATER (>)
- [OK] LESS_EQUAL (<=)
- [OK] GREATER_EQUAL (>=)
- [OK] NOT (!)
- [OK] AND (&)
- [OK] OR (|)
- number
- string
- let
- in
- True
- False
- if
- return
- else
- function
>let number = 42 in (let text = "The meaning of life is" in (print(text @ number)));
>let a = 42 in if (a % 2 == 0) print("Even") else print("odd");
>function fib(a)=> if(a==1) return 1 else return (fib(a-1)*a);
>print(23+print(21));