Skip to content

Commit 3c32383

Browse files
committed
rm debug logs
1 parent 37c1872 commit 3c32383

File tree

1 file changed

+0
-31
lines changed

1 file changed

+0
-31
lines changed

components/visuals/forth/components.tsx

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -532,22 +532,17 @@ export function Tokenizer() {
532532
const [terminal, setTerminal] = useState<React.ReactNode>(null);
533533

534534
useEffect(() => {
535-
console.log('[Tokenizer] Component mounted, starting loop');
536535
let cancelled = false;
537536
(async () => {
538537
while (!cancelled) {
539-
console.log('[Tokenizer] Starting tokenization run');
540538
await runTokenizer(() => cancelled, (node) => {
541-
console.log('[Tokenizer] Setting terminal node');
542539
setTerminal(node);
543540
});
544-
console.log('[Tokenizer] Tokenization run complete, waiting before next run');
545541
await new Promise((resolve) => setTimeout(resolve, TOKENIZER_FINISH_TIME));
546542
}
547543
})();
548544

549545
return () => {
550-
console.log('[Tokenizer] Component unmounting, cancelling');
551546
cancelled = true;
552547
}
553548
}, []);
@@ -558,20 +553,17 @@ export function Tokenizer() {
558553
}
559554

560555
async function runTokenizer(shouldStop: () => boolean, setTerminal: (node: React.ReactNode) => void) {
561-
console.log('[runTokenizer] Starting tokenization process');
562556
const tokens: Token[] = [];
563557
let highlight = { start: 0, end: 0 };
564558

565559
try {
566560
await tokenize(fib10, async (newHighlight, newTokens) => {
567561
if (shouldStop()) {
568-
console.log('[runTokenizer] Stopping due to cancellation');
569562
return;
570563
}
571564

572565
highlight = newHighlight;
573566
tokens.splice(0, tokens.length, ...newTokens);
574-
console.log(`[runTokenizer] Tokenized ${tokens.length} tokens, highlighting ${highlight.start}-${highlight.end}`);
575567

576568
const terminalNode = renderTokenizer(highlight, tokens);
577569
setTerminal(terminalNode);
@@ -705,22 +697,17 @@ export function Compiler() {
705697
const [terminal, setTerminal] = useState<React.ReactNode>(null);
706698

707699
useEffect(() => {
708-
console.log('[Compiler] Component mounted, starting loop');
709700
let cancelled = false;
710701
(async () => {
711702
while (!cancelled) {
712-
console.log('[Compiler] Starting compilation run');
713703
await runCompiler(() => cancelled, (node) => {
714-
console.log('[Compiler] Setting terminal node');
715704
setTerminal(node);
716705
});
717-
console.log('[Compiler] Compilation run complete, waiting before next run');
718706
await new Promise((resolve) => setTimeout(resolve, COMPILER_FINISH_TIME));
719707
}
720708
})();
721709

722710
return () => {
723-
console.log('[Compiler] Component unmounting, cancelling');
724711
cancelled = true;
725712
}
726713
}, []);
@@ -731,36 +718,30 @@ export function Compiler() {
731718
}
732719

733720
async function runCompiler(shouldStop: () => boolean, setTerminal: (node: React.ReactNode) => void) {
734-
console.log('[runCompiler] Starting compilation process');
735721
let tokens: Token[] = [];
736722
let bytecode: Bytecode[] = [];
737723
let highlightRange = { start: -1, end: -1 };
738724

739725
try {
740726
// First tokenize the source
741-
console.log('[runCompiler] Tokenizing source');
742727
const allTokens = await tokenize(fib10, async () => {
743728
// No-op callback for tokenization, just need the tokens
744729
});
745730

746731
if (shouldStop()) {
747-
console.log('[runCompiler] Stopping due to cancellation after tokenization');
748732
return;
749733
}
750734

751735
tokens = allTokens;
752-
console.log(`[runCompiler] Tokenized ${tokens.length} tokens`);
753736

754737
// Then compile with highlighting
755738
await compile(allTokens, async (highlight, newBytecode) => {
756739
if (shouldStop()) {
757-
console.log('[runCompiler] Stopping due to cancellation during compilation');
758740
return;
759741
}
760742

761743
highlightRange = { start: highlight.tokenIdxStart, end: highlight.tokenIdxEnd };
762744
bytecode = [...newBytecode];
763-
console.log(`[runCompiler] Compiled ${bytecode.length} bytecode ops, highlighting tokens ${highlightRange.start}-${highlightRange.end}`);
764745

765746
const terminalNode = renderCompiler(highlightRange, tokens, bytecode);
766747
setTerminal(terminalNode);
@@ -888,22 +869,17 @@ export function VM() {
888869
const [terminal, setTerminal] = useState<React.ReactNode>(null);
889870

890871
useEffect(() => {
891-
console.log('[VM] Component mounted, starting loop');
892872
let cancelled = false;
893873
(async () => {
894874
while (!cancelled) {
895-
console.log('[VM] Starting VM run');
896875
await runVM(() => cancelled, (node) => {
897-
console.log('[VM] Setting terminal node');
898876
setTerminal(node);
899877
});
900-
console.log('[VM] VM run complete, waiting before next run');
901878
await new Promise((resolve) => setTimeout(resolve, VM_FINISH_TIME));
902879
}
903880
})();
904881

905882
return () => {
906-
console.log('[VM] Component unmounting, cancelling');
907883
cancelled = true;
908884
}
909885
}, []);
@@ -914,7 +890,6 @@ export function VM() {
914890
}
915891

916892
async function runVM(shouldStop: () => boolean, setTerminal: (node: React.ReactNode) => void) {
917-
console.log('[runVM] Starting VM execution process');
918893
let bytecode: Bytecode[] = [];
919894
let highlightIP = -1;
920895
let dataStack: number[] = [];
@@ -923,13 +898,11 @@ async function runVM(shouldStop: () => boolean, setTerminal: (node: React.ReactN
923898

924899
try {
925900
// First tokenize and compile to get the program
926-
console.log('[runVM] Tokenizing and compiling source');
927901
const allTokens = await tokenize(fib10, async () => {
928902
// No-op
929903
});
930904

931905
if (shouldStop()) {
932-
console.log('[runVM] Stopping due to cancellation after tokenization');
933906
return;
934907
}
935908

@@ -938,25 +911,21 @@ async function runVM(shouldStop: () => boolean, setTerminal: (node: React.ReactN
938911
});
939912

940913
if (shouldStop()) {
941-
console.log('[runVM] Stopping due to cancellation after compilation');
942914
return;
943915
}
944916

945917
bytecode = program.bytecode;
946-
console.log(`[runVM] Compiled program with ${bytecode.length} bytecode ops`);
947918

948919
// Run the VM with highlighting
949920
await vm(program, async (highlight, newDataStack, newReturnStack, newVariableTable) => {
950921
if (shouldStop()) {
951-
console.log('[runVM] Stopping due to cancellation during VM execution');
952922
return;
953923
}
954924

955925
highlightIP = highlight.ip;
956926
dataStack = [...newDataStack];
957927
returnStack = [...newReturnStack];
958928
variableTable = [...newVariableTable];
959-
console.log(`[runVM] VM step at IP ${highlightIP}, DS: [${dataStack.join(',')}], RS: [${returnStack.join(',')}]`);
960929

961930
const terminalNode = renderVM(highlightIP, bytecode, dataStack, returnStack, variableTable);
962931
setTerminal(terminalNode);

0 commit comments

Comments
 (0)