Adding Stack and TextInput to the UI

This commit is contained in:
Dustin Swan 2026-02-03 00:14:33 -07:00
parent 50bb15e974
commit 223eea72e3
No known key found for this signature in database
GPG key ID: 30D46587E2100467
6 changed files with 226 additions and 11 deletions

View file

@ -7,6 +7,7 @@ import { builtins } from './builtins';
import counterApp from './counter.cg?raw';
import stdlibCode from './stdlib.cg?raw';
import textInputCode from './textinput-test.cg?raw';
import testCode from './test.cg?raw';
const canvas = document.createElement('canvas');
@ -14,7 +15,7 @@ canvas.width = 800;
canvas.height = 600;
document.body.appendChild(canvas);
const cgCode = stdlibCode + '\n' + testCode;
const cgCode = stdlibCode + '\n' + textInputCode;
const tokens = tokenize(cgCode);
const parser = new Parser(tokens);
@ -22,10 +23,9 @@ const ast = parser.parse();
console.log(ast);
const env: Env = new Map(Object.entries(builtins));
const res = evaluate(ast, env);
console.log(res);
// const res = evaluate(ast, env);
// console.log(res);
/*
const appRecord = evaluate(ast, env);
console.log(appRecord);
@ -38,4 +38,3 @@ const update = appRecord.fields.update;
const view = appRecord.fields.view;
runApp({ init, update, view }, canvas);
*/