diff options
Diffstat (limited to 'forth/foreforthfourth/debug-string2.js')
-rw-r--r-- | forth/foreforthfourth/debug-string2.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/forth/foreforthfourth/debug-string2.js b/forth/foreforthfourth/debug-string2.js new file mode 100644 index 0000000..01a42aa --- /dev/null +++ b/forth/foreforthfourth/debug-string2.js @@ -0,0 +1,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] +}); |