📄 cmm.java
字号:
/* Generated By:JJTree&JavaCC: Do not edit this line. Cmm.java */
package cmm;
@SuppressWarnings("all")public class Cmm/*@bgen(jjtree)*/implements CmmTreeConstants, CmmConstants {/*@bgen(jjtree)*/
protected static JJTCmmState jjtree = new JJTCmmState();public static void main(String args[]){
System.out.println("Reading from standard input...");
new Cmm(System.in);
try {
SimpleNode n = Cmm.Start();
n.dump("");
System.out.println("Thank you!");
} catch (Exception e) {
System.out.println("Oops.");
System.out.println(e.getMessage());
}
}
static final public SimpleNode Start() throws ParseException {
/*@bgen(jjtree) Start */
SimpleNode jjtn000 = new SimpleNode(JJTSTART);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
try {
Program();
jjtree.closeNodeScope(jjtn000, true);
jjtc000 = false;
{if (true) return jjtn000;}
} catch (Throwable jjte000) {
if (jjtc000) {
jjtree.clearNodeScope(jjtn000);
jjtc000 = false;
} else {
jjtree.popNode();
}
if (jjte000 instanceof RuntimeException) {
{if (true) throw (RuntimeException)jjte000;}
}
if (jjte000 instanceof ParseException) {
{if (true) throw (ParseException)jjte000;}
}
{if (true) throw (Error)jjte000;}
} finally {
if (jjtc000) {
jjtree.closeNodeScope(jjtn000, true);
}
}
throw new Error("Missing return statement in function");
}
static final public void Program() throws ParseException {
/*@bgen(jjtree) Program */
SimpleNode jjtn000 = new SimpleNode(JJTPROGRAM);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
try {
label_1:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case KEYWORD_INT:
case KEYWORD_REAL:
;
break;
default:
jj_la1[0] = jj_gen;
break label_1;
}
VarDeclare();
}
Sentence();
} catch (Throwable jjte000) {
if (jjtc000) {
jjtree.clearNodeScope(jjtn000);
jjtc000 = false;
} else {
jjtree.popNode();
}
if (jjte000 instanceof RuntimeException) {
{if (true) throw (RuntimeException)jjte000;}
}
if (jjte000 instanceof ParseException) {
{if (true) throw (ParseException)jjte000;}
}
{if (true) throw (Error)jjte000;}
} finally {
if (jjtc000) {
jjtree.closeNodeScope(jjtn000, true);
}
}
}
static final public void VarDeclare() throws ParseException {
/*@bgen(jjtree) VarDeclare */
SimpleNode jjtn000 = new SimpleNode(JJTVARDECLARE);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
try {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case KEYWORD_INT:
jj_consume_token(KEYWORD_INT);
break;
case KEYWORD_REAL:
jj_consume_token(KEYWORD_REAL);
break;
default:
jj_la1[1] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ID:
jj_consume_token(ID);
break;
case ARRAY:
jj_consume_token(ARRAY);
break;
default:
jj_la1[2] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
label_2:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 30:
;
break;
default:
jj_la1[3] = jj_gen;
break label_2;
}
jj_consume_token(30);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ID:
jj_consume_token(ID);
break;
case ARRAY:
jj_consume_token(ARRAY);
break;
default:
jj_la1[4] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
jj_consume_token(31);
} finally {
if (jjtc000) {
jjtree.closeNodeScope(jjtn000, true);
}
}
}
static final public void Sentence() throws ParseException {
/*@bgen(jjtree) Sentence */
SimpleNode jjtn000 = new SimpleNode(JJTSENTENCE);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
try {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case KEYWORD_BEGIN:
Complex();
break;
case ID:
case ARRAY:
Evaluate();
break;
case KEYWORD_IF:
IfSentence();
break;
case KEYWORD_WHILE:
WhileSentence();
break;
case KEYWORD_WRITE:
WriteSentence();
break;
case KEYWORD_READ:
ReadSentence();
break;
default:
jj_la1[5] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
} catch (Throwable jjte000) {
if (jjtc000) {
jjtree.clearNodeScope(jjtn000);
jjtc000 = false;
} else {
jjtree.popNode();
}
if (jjte000 instanceof RuntimeException) {
{if (true) throw (RuntimeException)jjte000;}
}
if (jjte000 instanceof ParseException) {
{if (true) throw (ParseException)jjte000;}
}
{if (true) throw (Error)jjte000;}
} finally {
if (jjtc000) {
jjtree.closeNodeScope(jjtn000, true);
}
}
}
static final public void Complex() throws ParseException {
/*@bgen(jjtree) Complex */
SimpleNode jjtn000 = new SimpleNode(JJTCOMPLEX);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
try {
jj_consume_token(KEYWORD_BEGIN);
Sentence();
label_3:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case KEYWORD_IF:
case KEYWORD_WHILE:
case KEYWORD_READ:
case KEYWORD_WRITE:
case KEYWORD_BEGIN:
case ID:
case ARRAY:
;
break;
default:
jj_la1[6] = jj_gen;
break label_3;
}
Sentence();
}
jj_consume_token(KEYWORD_END);
} catch (Throwable jjte000) {
if (jjtc000) {
jjtree.clearNodeScope(jjtn000);
jjtc000 = false;
} else {
jjtree.popNode();
}
if (jjte000 instanceof RuntimeException) {
{if (true) throw (RuntimeException)jjte000;}
}
if (jjte000 instanceof ParseException) {
{if (true) throw (ParseException)jjte000;}
}
{if (true) throw (Error)jjte000;}
} finally {
if (jjtc000) {
jjtree.closeNodeScope(jjtn000, true);
}
}
}
static final public void Evaluate() throws ParseException {
/*@bgen(jjtree) Evaluate */
SimpleNode jjtn000 = new SimpleNode(JJTEVALUATE);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
try {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ID:
jj_consume_token(ID);
break;
case ARRAY:
jj_consume_token(ARRAY);
break;
default:
jj_la1[7] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
jj_consume_token(32);
Expression();
jj_consume_token(31);
} catch (Throwable jjte000) {
if (jjtc000) {
jjtree.clearNodeScope(jjtn000);
jjtc000 = false;
} else {
jjtree.popNode();
}
if (jjte000 instanceof RuntimeException) {
{if (true) throw (RuntimeException)jjte000;}
}
if (jjte000 instanceof ParseException) {
{if (true) throw (ParseException)jjte000;}
}
{if (true) throw (Error)jjte000;}
} finally {
if (jjtc000) {
jjtree.closeNodeScope(jjtn000, true);
}
}
}
static final public void Expression() throws ParseException {
/*@bgen(jjtree) Expression */
SimpleNode jjtn000 = new SimpleNode(JJTEXPRESSION);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
try {
Item();
label_4:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case PLUSMINUS:
;
break;
default:
jj_la1[8] = jj_gen;
break label_4;
}
jj_consume_token(PLUSMINUS);
Item();
}
} catch (Throwable jjte000) {
if (jjtc000) {
jjtree.clearNodeScope(jjtn000);
jjtc000 = false;
} else {
jjtree.popNode();
}
if (jjte000 instanceof RuntimeException) {
{if (true) throw (RuntimeException)jjte000;}
}
if (jjte000 instanceof ParseException) {
{if (true) throw (ParseException)jjte000;}
}
{if (true) throw (Error)jjte000;}
} finally {
if (jjtc000) {
jjtree.closeNodeScope(jjtn000, true);
}
}
}
static final public void Item() throws ParseException {
/*@bgen(jjtree) Item */
SimpleNode jjtn000 = new SimpleNode(JJTITEM);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
try {
Factor();
label_5:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case MULTIPLYDIVIDE:
;
break;
default:
jj_la1[9] = jj_gen;
break label_5;
}
jj_consume_token(MULTIPLYDIVIDE);
Factor();
}
} catch (Throwable jjte000) {
if (jjtc000) {
jjtree.clearNodeScope(jjtn000);
jjtc000 = false;
} else {
jjtree.popNode();
}
if (jjte000 instanceof RuntimeException) {
{if (true) throw (RuntimeException)jjte000;}
}
if (jjte000 instanceof ParseException) {
{if (true) throw (ParseException)jjte000;}
}
{if (true) throw (Error)jjte000;}
} finally {
if (jjtc000) {
jjtree.closeNodeScope(jjtn000, true);
}
}
}
static final public void Factor() throws ParseException {
/*@bgen(jjtree) Factor */
SimpleNode jjtn000 = new SimpleNode(JJTFACTOR);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
try {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ID:
jj_consume_token(ID);
break;
case ARRAY:
jj_consume_token(ARRAY);
break;
case INT:
jj_consume_token(INT);
break;
case REAL:
jj_consume_token(REAL);
break;
case 33:
jj_consume_token(33);
Expression();
jj_consume_token(34);
break;
default:
jj_la1[10] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
} catch (Throwable jjte000) {
if (jjtc000) {
jjtree.clearNodeScope(jjtn000);
jjtc000 = false;
} else {
jjtree.popNode();
}
if (jjte000 instanceof RuntimeException) {
{if (true) throw (RuntimeException)jjte000;}
}
if (jjte000 instanceof ParseException) {
{if (true) throw (ParseException)jjte000;}
}
{if (true) throw (Error)jjte000;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -