Oporavak od grešaka (CUP)
Je l' ima neko ideju zašto dobijam grešku "Couldn't repair and continue
parse Object" sa ovom gramatikom i test programom? Zar ne bi trebalo da
"main_function ::= BEGIN error END" odradi oporavak pošto "error SEMI"
ne može jer nedostaje ; iza x?
// CUP ----------------------------------
start with program;
program ::= prog_decl main_function;
prog_decl ::= PROGRAM ID SEMI;
main_function ::= BEGIN END;
main_function ::= BEGIN statements END;
main_function ::= BEGIN error END {: System.out.println("main_function_error");
:};
statements ::= statement statements;
statements ::= statement;
statement ::= ID EQ INTEGER_LITERAL SEMI;
statement ::= error SEMI {: System.out.println("statement error"); :};
// microJava ----------------------------------
program pp;
begin
z=4;
x
end.
// CUP ----------------------------------
start with program;
program ::= prog_decl main_function;
prog_decl ::= PROGRAM ID SEMI;
main_function ::= BEGIN END;
main_function ::= BEGIN statements END;
main_function ::= BEGIN error END {: System.out.println("main_function_error");
:};
statements ::= statement statements;
statements ::= statement;
statement ::= ID EQ INTEGER_LITERAL SEMI;
statement ::= error SEMI {: System.out.println("statement error"); :};
// microJava ----------------------------------
program pp;
begin
z=4;
x
end.
- Follow-Ups:
- Re: Oporavak od gre¹aka (CUP)
- From: jelena markicevic <markicevic011@yahoo.com>
- Re: Oporavak od gre¹aka (CUP)
Previous by date: Re: HITNO - kontrolne strukture u nivou A?
Next by date: Pitanje
Previous by thread: Re: HITNO - kontrolne strukture u nivou A? Next by thread: Re: Oporavak od gre¹aka (CUP)
Previous by thread: Re: HITNO - kontrolne strukture u nivou A? Next by thread: Re: Oporavak od gre¹aka (CUP)