上图是编译原理课件上的示例,我对前两行实在不解,遂改写为如下版本#include <bits/stdc++.h> using namespace std; int main() { char buf[] = "bababb#"; char* ptr = buf; while (*ptr != '#') { l0: // while (*ptr == 'b') ptr++; // state 0 switch (*ptr) { case 'a': ptr++; goto l1; case 'b': ptr++; goto l0; l1: // while (*ptr == 'a') ptr++; // state 1 switch (*ptr) {
Genghong Hu
Hi