关于Basic程序解释器及编译原理的简单化(1)---Basic器的语法分析及主要代码(7) case '<': if (x<y) cond=1; break; case '>': if (x>y) cond=1; break; case '==': if (x==y) cond=1; break; } if (cond) { /* is true so process target of IF */ get_token(); if (tok != THEN) { serror(8); return; } /* else program execution starts on next line */ } else find_eol(); /* find start of next line */ }
/* execute a FOR loop */ void exec_for() { struct for_stack i; int value;
get_token(); /* read the control variable */ if (!isalpha(*token)) { serror(4); return; }
i.var = toupper(*token) - 'A'; /* save its index */
get_token(); /* read the equal sign */ if (*token!='=') { serror(3); return; }