diff --git a/src/components/InteractiveCode.astro b/src/components/InteractiveCode.astro index 4838f51..014faba 100644 --- a/src/components/InteractiveCode.astro +++ b/src/components/InteractiveCode.astro @@ -1,5 +1,7 @@ --- import { lex } from "../lexer/lexer"; +import type { Instruction } from "../thp_machine/machine_parser"; +import { parse_str } from "../thp_machine/machine_parser"; const {code, steps} = Astro.props; /** @@ -97,6 +99,15 @@ function highlightCode(lines: Array): string { } const codeHtml = highlightCode(trimAndDedent(code)); +let instructionSet: Array>; +try { + instructionSet = parse_str(steps); +} catch (e) { + console.error(Astro.url); + throw e; +} + +const serialized_inst = JSON.stringify(instructionSet); ---