Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package parsery.interpreter;
- import java_cup.runtime.*;
- parser code {:
- public static InterpreterUnix unix = new InterpreterUnix();
- public void syntax_error(Symbol token)
- {
- report_error("Blad skladniowy ",token);
- }
- public void report_error(String message, Object info)
- {
- StringBuffer m = new StringBuffer(message);
- if (info instanceof java_cup.runtime.Symbol)
- {
- java_cup.runtime.Symbol s = (java_cup.runtime.Symbol) info;
- if (s.left >= 0)
- {
- m.append("w wierszu "+(s.left+1));
- if (s.right>=0) m.append(" w kolumnie "+(s.right+1));
- }
- }
- System.err.println("BLAD "+m);
- }
- public void report_fatal_error(String message, Object info)
- {
- report_error("KRYTYCZNY "+message, info);
- }
- :};
- /* ------------Declaration of Terminals and Non Terminals Section----------- */
- terminal DATE;
- non terminal komenda, polecenie,polecenieDATE;
- /* ----------------------------Grammar Section-------------------- */
- /*
- komenda ::= polecenie
- polecenieDATE ::= DATE
- */
- komenda ::= polecenie:p
- {: RESULT = p; :}
- ;
- polecenie ::= polecenieDATE:pDATE
- {: RESULT = pDATE; :}
- ;
- polecenieDATE::= DATE:date
- {: RESULT = parser.unix.polecenieDATE(""); :}
- ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement