add PI
This commit is contained in:
parent
8bf6d94b6f
commit
7e71612592
1 changed files with 3 additions and 2 deletions
|
|
@ -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) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue