Exemple #1
0
 private void interpretToken(String nextToken) {
   DictionaryEntry entry = dictionary.search(nextToken);
   if (entry != null) {
     entry.getTokenDefinition().execute();
   } else {
     Integer number = parseNumber(nextToken);
     if (number != null) {
       VmEngine.getInstance().push(number);
     } else {
       error = true;
     }
   }
 }
Exemple #2
0
 private void compileToken(String token) {
   DictionaryEntry entry = dictionary.search(token);
   if (entry != null) {
     if (entry.isImmediate()) {
       entry.getTokenDefinition().execute();
     } else {
       entry.getTokenDefinition().compile();
     }
   } else {
     Integer number = parseNumber(token);
     if (number != null) {
       new LiteralNumber(number.intValue()).compile();
     } else {
       error = true;
     }
   }
 }