This commit is contained in:
Shautvast 2024-12-09 22:29:05 +01:00
parent 8bf6d94b6f
commit 7e71612592

View file

@ -15,8 +15,9 @@ import {
import {atan, cos, random, sin, tan} from "./functions"; import {atan, cos, random, sin, tan} from "./functions";
export function interpret(init_env, code) { export function interpret(init_env, code) {
const log_console = document.getElementById("log");
let {canvas, tx, ty, tangle, unit, width, height} = init_env; let {canvas, tx, ty, tangle, unit, width, height} = init_env;
init_env.PI = Math.PI;
const UP = "UP"; const UP = "UP";
const DOWN = "DOWN"; const DOWN = "DOWN";
const LEFT = "LEFT"; const LEFT = "LEFT";
@ -76,7 +77,7 @@ export function interpret(init_env, code) {
visitPrintStatement: (expression) => { visitPrintStatement: (expression) => {
let value = THIS.evaluate(expression); let value = THIS.evaluate(expression);
console.log(THIS.stringify(value)); log_console.innerText = THIS.stringify(value);
}, },
visitCallStatement: (fun, argList) => { visitCallStatement: (fun, argList) => {