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
33
|
// Test to see the complete help output
const ForthInterpreter = require('./forth.js');
console.log('🔍 Testing Complete Help Output\n');
let state = ForthInterpreter.createInitialState();
// Run help command
console.log('Running help command...');
state = ForthInterpreter.parseAndExecute(state, 'help');
console.log('\n=== COMPLETE HELP OUTPUT ===');
state.output.forEach((line, i) => {
console.log(`${i + 1}: ${line}`);
});
console.log('\n=== ANALYSIS ===');
console.log('Total output lines:', state.output.length);
// Count built-in words in help output
const helpLines = state.output.filter(line => line.includes(' - '));
console.log('Lines with word documentation:', helpLines.length);
// Check if specific words are present
const expectedWords = ['dup', 'swap', 'drop', '+', '-', '*', '/', 'mod', 'if', 'then', 'begin', 'until'];
expectedWords.forEach(word => {
const found = helpLines.some(line => line.startsWith(word));
console.log(`${word}: ${found ? '✅' : '❌'}`);
});
// Show first few documented words
console.log('\nFirst 10 documented words:');
helpLines.slice(0, 10).forEach(line => console.log(line));
|