| 1234567891011121314151617181920212223242526272829303132333435 |
- //OutputStmt:top//
- //OutputStmt:import//
- import java.util.*;
- // <stmt>OutputStmt ::= <OUT> <exp> <SEMI>
- public class OutputStmt extends Stmt /*OutputStmt:class*/ {
- public static final String $className = "OutputStmt";
- public static final String $ruleString =
- "<stmt>OutputStmt ::= <OUT> <exp> <SEMI>";
- public Token out;
- public Exp exp;
- public Token semi;
- public OutputStmt(Token out, Exp exp, Token semi) {
- //OutputStmt:init//
- this.out = out;
- this.exp = exp;
- this.semi = semi;
- }
- public static OutputStmt parse(Scan scn$, Trace trace$) {
- if (trace$ != null)
- trace$ = trace$.nonterm("<stmt>OutputStmt", scn$.lno);
- Token out = scn$.match(Token.Match.OUT, trace$);
- Exp exp = Exp.parse(scn$, trace$);
- Token semi = scn$.match(Token.Match.SEMI, trace$);
- return new OutputStmt(out, exp, semi);
- }
- public void execute() { System.out.println(exp.eval()); }
- //OutputStmt//
- }
|