UNPKG

@gyro-lang/core

Version:

Fast, Performant and scalable programming language designed for string manipulation and deep recursion.

45 lines (39 loc) 942 B
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Gyro</title> </head> <body> </body> <script type="module"> import {parse, Environment, evaluate, InputStream, TokenStream, compileJS} from "./lib/index.js"; window.Environment = Environment; window.parse = parse; window.evaluate = evaluate; window.InputStream = InputStream; window.TokenStream = TokenStream; const code = ` (x: int) = 5; (y: int) = 10; (z: int) = x + y; (fun: int) = func((a: int), b) { a + b; }; w = z * 2; print(fun(5,100)); print(w); `; const env = new Environment(null); env.def("print", (...args) => { console.log(...args); }); const input = new InputStream(code); const tokens = new TokenStream(input); const ast = parse(tokens); console.log(ast); evaluate(ast, env); </script> </html>