Dan
2004-06-09 01:37:11 UTC
Hi,
I've been looking at the assignment and have seen two ways to do it - one
way uses three states plus an error state, and the other is about 8 states
(the numbers are very approximate). In order for the three state system to
work, it is necessary to do some major error checking in the code block of
one of the states. So, I guess my question boils down to: How much code
are we allowed to add to a state? Can we have items such as this:
int base;
<State> [0-9] {
base = base*10 +yytext();
if (base > 36 || base < 2){
Yynext(Error);
} else {
//Do other code
}
}
Or is this too much code in a state?
Thanks,
Dan
I've been looking at the assignment and have seen two ways to do it - one
way uses three states plus an error state, and the other is about 8 states
(the numbers are very approximate). In order for the three state system to
work, it is necessary to do some major error checking in the code block of
one of the states. So, I guess my question boils down to: How much code
are we allowed to add to a state? Can we have items such as this:
int base;
<State> [0-9] {
base = base*10 +yytext();
if (base > 36 || base < 2){
Yynext(Error);
} else {
//Do other code
}
}
Or is this too much code in a state?
Thanks,
Dan