about summary refs log tree commit diff stats
path: root/forth/foreforthfourth/debug-string2.js
blob: 01a42aa7b08881ab3469029d85b6f1914dcc8109 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Debug string literals with actual command format
const ForthInterpreter = require('./forth.js');

console.log('🔍 Debugging String Literals - Command Format\n');

let state = ForthInterpreter.createInitialState();

console.log('Testing: ." Hello World"');
state = ForthInterpreter.parseAndExecute(state, '." Hello World"');
console.log('Result:', {
    stringMode: state.stringMode,
    currentString: state.currentString,
    stacks: state.stacks[0]
});

console.log('\nTesting: ." Hello"');
state = ForthInterpreter.createInitialState();
state = ForthInterpreter.parseAndExecute(state, '." Hello"');
console.log('Result:', {
    stringMode: state.stringMode,
    currentString: state.currentString,
    stacks: state.stacks[0]
});

console.log('\nTesting: ." Test"');
state = ForthInterpreter.createInitialState();
state = ForthInterpreter.parseAndExecute(state, '." Test"');
console.log('Result:', {
    stringMode: state.stringMode,
    currentString: state.currentString,
    stacks: state.stacks[0]
});