1 2 3 | a = 3; 3 aa = a * 4; b = aa / ( a - 3 ); |
1 2 3 4 5 6 7 8 | Error 'syntax error' Error: reference to unknown variable 'aa' division by zero! final content of variables Name------------------ Value---------- 'a ' 3 'b ' 3 'aa ' 0 |
1 2 3 4 5 | #define YY_INPUT(buf,result,max_size) {\ result = GetNextChar(buf, max_size); \ if ( result <= 0 ) \ result = YY_NULL; \ } |
1 2 3 4 5 6 7 8 9 10 | |....+....:....+....:....+....:....+....:....+....:....+ 1 |a = 3; 2 |3 aa = a * 4; ...... !.....^ Error: syntax error, unexpected IDENTIFIER, expecting SEMICOLON 3 |b = aa / ( a - 3 ); ...... !.......^ Error: reference to unknown variable 'aa' ...... !.................^ Error: division by zero! |
1 2 3 | 2 |3 aa = a * 4; ...... !..^^............ Error: syntax error, unexpected IDENTIFIER, expecting SEMICOLON |
1 2 3 4 5 6 7 | typedef struct YYLTYPE { int first_line; int first_column; int last_line; int last_column; } YYLTYPE; |
1 2 3 4 | | expression DIV expression { $$ = ReduceDiv($1, $3, &@3); } |
1 2 3 4 5 6 7 8 9 10 | extern double ReduceDiv(double a, double b, YYLTYPE *bloc) { if ( b == 0 ) { PrintError("division by zero! Line %d:c%d to %d:c%d", bloc->first_line, bloc->first_column, bloc->last_line, bloc->last_column); return MAXFLOAT; } return a / b; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |....+....:....+....:....+....:....+....:....+....:....+ 1 |a = 3; 2 |3 aa = a * 4; ...... !..^^........... Error: syntax error, unexpected IDENTIFIER, expecting SEMICOLON 3 |b = aa / ( a - 3 ); ...... !....^^............... Error: reference to unknown variable 'aa' ...... !.................^.. Error: division by zero! Line 3:10 to 3:18 final content of variables Name------------------ Value---------- 'a ' 3 'b ' 3.40282e+38 'aa ' 0 |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |