https://github.com/zpnst/refunpy
Executable specification of FunC / Tiny FunC interpreter on ReFalPy
https://github.com/zpnst/refunpy
interpreter refal semantics
Last synced: 8 months ago
JSON representation
Executable specification of FunC / Tiny FunC interpreter on ReFalPy
- Host: GitHub
- URL: https://github.com/zpnst/refunpy
- Owner: zpnst
- License: mit
- Created: 2025-04-18T21:01:10.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-05-02T16:06:11.000Z (12 months ago)
- Last Synced: 2025-06-20T21:49:07.866Z (10 months ago)
- Topics: interpreter, refal, semantics
- Language: Python
- Homepage:
- Size: 38.1 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Executable specification of FunC / Tiny FunC interpreter on ReFalPy
## How to use:
```
./refunpy --help
```
## Cloning:
```
git clone --recurse-submodules git@github.com:zpnst/refunpy.git
```
## Example:
FunC programm:
```C
{-
Simple,
FunC programm!
-}
const A = 222;
int plus(int x, int y) impure inline {
return x + y;
}
;; Hello!
(int, int) mult_plus(int x, int y) impure inline_ref {
return (
plus(x * y, x * y) + A,
(plus(x * y, x * y) + 2) / 3
);
}
;; This is STRDUMP TVM instruction!
() ~strLog(slice value) impure asm "STRDUMP";
() main() impure { ;; Main function!
int hello = "Hello!\n"; ;; Hello!
~strLog(hello);
(int res4, int res5) = mult_plus(1, 2);
return (); {-
Hello, World!
-}
}
```
Output:
```shell
zpnst@debian ~/D/p/p/c/p/refunpy (v2)> ./refunpy contracts/p.func --env
Hello!
-- RES: (('glob', (('A', 222),), 'funcs', ((('hello', '"Hello!\\n"'), ('res4', 226), ('res5', 2)),)),)
```