Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/assyrianic/Urhay-Interpreter
a small, educational AST interpreter that implements a dynamically-typed, C-like language.
https://github.com/assyrianic/Urhay-Interpreter
Last synced: 2 months ago
JSON representation
a small, educational AST interpreter that implements a dynamically-typed, C-like language.
- Host: GitHub
- URL: https://github.com/assyrianic/Urhay-Interpreter
- Owner: assyrianic
- License: mit
- Created: 2018-12-23T02:43:54.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-12-28T17:40:19.000Z (about 6 years ago)
- Last Synced: 2024-11-09T17:36:36.386Z (3 months ago)
- Language: C
- Homepage:
- Size: 70.3 KB
- Stars: 4
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- AwesomeInterpreter - Urhay-Interpreter
README
# Urhay Interpreter
a small, educational AST interpreter that implements a dynamically-typed, C-like language.## Example Code:
```javascript
main()
{
var i = 5, x = 8;
func1(ptr_test, &x);
if i==5 {
i+=2;
}
return i;
}func1(f, x)
{
f(x);
}ptr_test(ref)
{
@ref = 10;
}fib(n)
{
return n<2 ? n : fib(n-1) + fib(n-2);
}
```## Features:
* Basic Integer & Float Math (division not implemented yet).
* Function Calls (recursive is supported!).
* Pointers and pointer operations for passing variable by reference.
* Function Pointers.
* `if-else` conditional statements.
* `while` loops (implemented as `for`).
* `return` statements.
* Basic arithmetic ops like `+ - *`.
* Basic bitwise ops like `& | ^ << >>`.
* Basic logical ops like `&& ||`
* Basic comparison ops like `!= == < > <= >=`.
* Basic variables which are dynamically typed and can be used with both integer, float, and pointer operations alike.
* Ignores C++ style `//` and C style `/* */` comments.
* ternary operators
* Compound assignments like `+= -= *=`
* Mixed integer and float expressions resolve to float