Saturday, 4 August 2012
Natural/ADABAS to JAVA converter
options {
IGNORE_CASE = true;
DEBUG_PARSER = false;
DEBUG_LOOKAHEAD = false;
DEBUG_TOKEN_MANAGER = false;
LOOKAHEAD = 2;
FORCE_LA_CHECK=true;
MULTI=true;
VISITOR=true;
NODE_DEFAULT_VOID=true;
}
PARSER_BEGIN(ARSconverter)
public class ARSconverter {
//Parser execution
public static void main ( String args [ ] ) {
//Parser initialization
ARSconverter parser;
WorkArea.localMemArea="lGztkonp0";
WorkArea.globalMemArea="gGztkonp0";
//System.out.println(WorkArea.i);
if(args.length == 0){
System.out.println ("\nARSconverter: GIRIS OKUNUYOR ...\n\n");
parser = new ARSconverter(System.in);
} else if(args.length == 1){
System.out.println ("ARSconverter: Reading the file " + args[0] + " ..." );
try {
parser = new ARSconverter(new java.io.FileInputStream(args[0]));
} catch(java.io.FileNotFoundException e) {
System.out.println ("ARSconverter: The file " + args[0] + " was not found.");
return;
}
} else {
System.out.println ("ARSconverter: You must use one of the following:");
System.out.println (" java ARSconverter < file");
System.out.println ("Or");
System.out.println (" java ARSconverter file");
return ;
}
try {
ASTStart n = parser.Start();
//n.dump("");
System.out.println ("\n\nARSconverter: PARSE ISLEMI BASARILDI");
System.out.println ("\n\nARSconverter: CONVERSION ISLEMI BASLADI");
ARSconverterVisitor v = new ARSconverterDumpVisitor();
n.jjtAccept(v, null);
System.out.println ("\n\nARSconverter: CONVERSION ISLEMI BASARILDI");
} catch(ParseException e){
System.out.println ("ARSconverter: There was an error during the parse.");
System.out.println (e.getMessage());
} catch(TokenMgrError e){
System.out.println ("ARSconverter: There was an error.");
System.out.println (e.getMessage());
}
}
public static String indentString(int l) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < l; ++i) {
sb.append(' ');
}
return sb.toString();
}
}
PARSER_END(ARSconverter)
//STRUCTURES AND CHARACTERS TO SCAPE
SKIP : {
" "
| "\t"
// | "\n"
// | "\r"
// | "*\r\n"
// | <"rem" (~["\n","\r"])* ("\n" | "\r" | "\r\n")>
}
//STATIC TOKENS
TOKEN : {
<INTEGER_CONSTANT: (<DIGIT>)+>
| <LOGIC_CONSTANT: "true" | "false" | "-1">
| <#DIGIT: ["0"-"9"]>
}
//RESERVED WORDS
TOKEN : {
/* A */
<AND: "and">
| <ADD: "add">
| <ALARM: "alarm">
| <AT_END_OF_DATA: "at end of data">
| <AT_BREAK_OF: "at break of">
| <AT_TOP_OF_PAGE: "at top of page">
/* B */
| <BY: "by">
| <BOTTOM: "bottom">
/* C */
| <COMPUTE: "compute">
| <COMMENT: "CCMMNNTT">
| <CONTROL: "control">
/* D */
| <DEFINE: "define">
| <DATA: "data">
| <DISPLAY: "display">
/* E */
| <ELSE: "else">
| <END: "end">
| <END_BREAK: "end-break">
| <END_DEFINE: "end-define">
| <END_ENDDATA: "end-enddata">
| <END_FIND: "end-find">
| <END_FOR: "end-for">
| <END_IF: "end-if">
| <END_READ: "end-read">
| <END_ALL: "end-all">
| <END_NOREC: "end-norec">
| <END_REPEAT: "end-repeat">
| <END_SUBROUTINE: "end-subroutine">
| <END_TOPPAGE: "end-toppage">
| <ESCAPE: "escape">
/* F */
| <FIND: "find">
| <FROM: "from">
| <FOR: "for">
| <FORMAT: "format">
/* G */
| <GET: "get">
/* I */
| <IF: "if">
| <IN: "in">
| <INPUT : "input">
/* K */
| <KEY: "key">
/* L */
| <LIMIT: "limit">
| <LOGICAL: "logical">
| <LOCAL: "local">
/* M */
| <MOVE: "move">
| <MAP: "map">
| <MARK: "mark">
/* N */
| <NAMED: "named">
| <NOTITLE: "notitle">
| <NOHDR: "nohdr">
| <NOT: "not">
| <NO_REC_FOUND: "no record found">
| <NO_ERASE: "no erase">
/* O */
| <OR: "or">
/* P */
| <PERFORM: "perform">
/* R */
| <READ: "read">
| <RECORD: "record">
| <REPEAT: "repeat">
| <RESET: "reset">
| <REINPUT: "reinput">
| <ROUTINE: "routine">
/* S */
| <SET: "set">
| <SIZE: "size">
| <SORTED: "sorted">
| <STORE: "store">
| <SUBTRACT: "subtract">
| <SUBROUTINE: "subroutine">
/* T */
| <TO: "to">
| <TOP: "top">
| <THRU: "thru">
/* U */
| <USING: "using">
| <UPDATE: "update">
/* W */
| <WINDOW: "window">
| <WITH: "with">
| <WHERE: "where">
| <WRITE: "write">
}
TOKEN :
{
<SG : ("SG=" ("OFF" | "ON" )+)>
| <LS : ("LS=" (<INTEGER_CONSTANT>)+)>
| <PS : ("PS=" (<INTEGER_CONSTANT>)+)>
| <AD : ("AD=" (("M'_'") | ("MI'_'") | "P" | "I")) >
| <ASSIGNCHARS : <COLONCHAR><EQUALCHAR>>
| <IP : ("IP=" ("OFF" | "ON" )+)>
| <MASK : ( "MASK" <LPARENCHAR><NATURAL_WORD><RPARENCHAR>)>
}
TOKEN :
{
// < LEVEL_66: "66" >
// < LEVEL_NUMBER: ( (("0")? ["1"-"9"]) | (["1"-"4"]["0"-"9"]) | "78" ) >
// < INTEGER: (["0"-"9"])+ >
< MINUSCHAR: "-" > // a.k.a. dash
| < LPARENCHAR: "(" >
| < RPARENCHAR: ")" >
| < COLONCHAR: ":" >
| < DOTCHAR: "." >
| < COMMACHAR: "," >
| < DOUBLEDQUOTECHAR: "\"\"" >
| < QUOTECHAR: "\"" >
| < DOUBLEDAPOSTROPHE: "''" >
| < APOSTROPHE: "'" >
| < PLUSCHAR: "+" >
| < ASTERISKCHAR: "*" >
//| < POWEROF: "**" >
| < SLASHCHAR: "/" >
| < DOLLARCHAR: "$" >
| < LESSTHANOREQUAL: "<=" >
| < LESSTHANCHAR: "<" >
| < MORETHANOREQUAL: ">=" >
| < MORETHANCHAR: ">" >
| < EQUALCHAR: "=" >
| < NOTEQUAL: "<>" >
| < WNOTEQUAL: "NE" >
| < SHARPCHAR: "#" >
//| < COMPARISON_OP: (["=","<",">"])+>
| < HEXNUMBER: ["h","x"] ( ( <QUOTECHAR> ( ["0"-"9","a"-"f"] )+ <QUOTECHAR> )
| ( <APOSTROPHE> ( ["0"-"9","a"-"f"] )+ <APOSTROPHE> )
)
>
| < QUOTEDSTRING: ( <QUOTECHAR> (~["\""] | <DOUBLEDQUOTECHAR> )* <QUOTECHAR>
| <APOSTROPHE> (~["'"] | <DOUBLEDAPOSTROPHE> )* <APOSTROPHE>
)
>
| <REINPUT_ASTERISK_PARM: <ASTERISKCHAR> ((["0"-"9"])(["0"-"9"])(["0"-"9"])) >
// | <REINPUT_MARK_PARM: (<SHARPCHAR>| <PLUSCHAR>)? <NATURAL_WORD> >
| < NATURAL_WORD: (["a"-"z","0"-"9"])+ ( (<MINUSCHAR> | "_" )+ (["a"-"z","0"-"9"])+ )* >
| < OTHER_CHARS: ~[] >
}
TOKEN: {
<COMMENT_LINE: (<COMMENT> <ASTERISKCHAR> (<GENERAL>)* "\r\n")>
| <#GENERAL: (["a"-"z","A"-"Z", "0"-"9", "(", ")", "[", "]", ":", "\'", "*", "|", ";",
"%", "-", "/", "."," ", "=", "#", "@", "+", "_", "<", ">", "^", "$",
"?", "&", ",", "ı", "İ", "ş", "Ş", "ü", "Ü", "ç", "Ç", "ğ", "Ğ", "ö", "Ö"])>
}
void CodeLine() :
{//System.out.println("\nCodeLine");
Token t;}
{
(<COMMENT_LINE> | NaturalStatementLine())
}
void NaturalStatementLine() :
{}
{
NaturalStatement()
}
void NaturalStatement() :
{}
{
MoveStatement()
| IfStatement()
| ComputeStatement()
| ComputationStatement()
| DotStatament()
}
Token compare() :
{Token t=null;}
{
(
t=<EQUALCHAR>
| t=<LESSTHANCHAR>
| t=<LESSTHANOREQUAL>
| t=<MORETHANCHAR>
| t=<MORETHANOREQUAL>
| t=<NOTEQUAL>
| t=<WNOTEQUAL>
)
{return t;}
}
Token mem_type() :
{Token t=null;}
{
(t=<SHARPCHAR> | t=<PLUSCHAR> | t=<ASTERISKCHAR>)
{return t;}
}
ASTDot DotStatament() #Dot :
{System.out.println();System.out.println("Dot statement");}
{
<DOTCHAR> ("\r\n") {System.out.println("DOTCHAR");}
{ return jjtThis; }
}
ASTMove MoveStatement() #Move:
{System.out.println();System.out.println("Move statement");
Token mv_int_const=null, mv_nat_w1_1=null, mv_dot=null;
Token mv_mem_type=null, mv_nat1_2=null;
Token mv_quo_str=null, mv_lp=null, mv_ad=null, mv_rp=null;
Token mv_to=null;
Token[] mv_to_mem_type2_1=new Token[10], mv_to_nat_w2_1=new Token[10];
Token[] mv_to_lp=new Token[10], mv_to_asterisk=new Token[10];
Token[] mv_to_int_const=new Token[10], mv_to_mem_type2_2=new Token[10];
Token[] mv_to_nat_w2_2=new Token[10], mv_to_rp=new Token[10];
int i=0;
}
{
<MOVE> {System.out.print("MOVE ");}
(
mv_int_const=<INTEGER_CONSTANT> {System.out.print(mv_int_const.image);}
|(mv_nat_w1_1=<NATURAL_WORD> {System.out.print(mv_nat_w1_1.image);} mv_dot=<DOTCHAR> {System.out.print(mv_dot.image);})?
((( mv_mem_type=mem_type() {System.out.print(mv_mem_type.image);})?) mv_nat1_2=<NATURAL_WORD>{System.out.print(mv_nat1_2.image);})
| mv_quo_str=<QUOTEDSTRING> {System.out.print(mv_quo_str.image);}
| mv_lp=<LPARENCHAR> {System.out.print(mv_lp.image);} mv_ad=<AD> {System.out.print(mv_ad.image);} mv_rp=<RPARENCHAR> {System.out.print(mv_rp.image);}
)
mv_to=<TO> {System.out.print(" "+mv_to.image +" ");}
(
(mv_to_mem_type2_1[i]=mem_type(){System.out.print(mv_to_mem_type2_1[i].image);})?
mv_to_nat_w2_1[i]=<NATURAL_WORD> {System.out.print(mv_to_nat_w2_1[i].image);}
(
mv_to_lp[i]=<LPARENCHAR> {System.out.print(mv_to_lp[i].image);}
(
mv_to_asterisk[i]=<ASTERISKCHAR> {System.out.print(mv_to_asterisk[i].image);}
| mv_to_int_const[i]=<INTEGER_CONSTANT> {System.out.print(mv_to_int_const[i].image);}
| (mv_to_mem_type2_2[i]=mem_type() {System.out.print(mv_to_mem_type2_2[i].image);})?
mv_to_nat_w2_2[i]=<NATURAL_WORD> {System.out.print(mv_to_nat_w2_2[i].image);}
)
mv_to_rp[i]=<RPARENCHAR>{System.out.print(mv_to_rp[i].image);}
)? {i++;}
)+
("\r\n")? {System.out.println();}
{
jjtThis.setMv_int_const(mv_int_const);
jjtThis.setMv_nat_w1_1(mv_nat_w1_1);
jjtThis.setMv_dot(mv_dot);
jjtThis.setMv_mem_type(mv_mem_type);
jjtThis.setMv_nat1_2(mv_nat1_2);
jjtThis.setMv_quo_str(mv_quo_str);
jjtThis.setMv_lp(mv_lp);
jjtThis.setMv_ad(mv_ad);
jjtThis.setMv_rp(mv_rp);
jjtThis.setMv_to(mv_to);
jjtThis.setMv_to_mem_type2_1(mv_to_mem_type2_1);
jjtThis.setMv_to_nat_w2_1(mv_to_nat_w2_1);
jjtThis.setMv_to_lp(mv_to_lp);
jjtThis.setMv_to_asterisk(mv_to_asterisk);
jjtThis.setMv_to_int_const(mv_to_int_const);
jjtThis.setMv_to_mem_type2_2(mv_to_mem_type2_2);
jjtThis.setMv_to_nat_w2_2(mv_to_nat_w2_2);
jjtThis.setMv_to_rp(mv_to_rp);
jjtThis.setMv_i(i);
}
{ return jjtThis; }
}
ASTCompute ComputeStatement() #Compute:
{System.out.println();System.out.println("Compute statement");
Token compute_mem_type1=null, compute_nat_w1=null;
Token compute_equal=null, compute_equal_int_const=null, compute_equal_mem_type=null;
Token compute_equal_nat_w=null, compute_equal_quo_str=null;
Token[] compute_loop_op=new Token[10], compute_loop_int_const=new Token[10];
Token[] compute_loop_mem_type=new Token[10], compute_loop_nat_w=new Token[10];
int i=0;
}
{ <COMPUTE> {System.out.print("COMPUTE ");}
( (compute_mem_type1=mem_type() {System.out.print(compute_mem_type1.image);})?
compute_nat_w1=<NATURAL_WORD>{System.out.print(compute_nat_w1.image);}
)
<EQUALCHAR> {System.out.print(" = ");}
( compute_equal_int_const=<INTEGER_CONSTANT> {System.out.print(compute_equal_int_const.image);}
| (compute_equal_mem_type=mem_type(){System.out.print(compute_equal_mem_type.image);})?
compute_equal_nat_w=<NATURAL_WORD> {System.out.print(compute_equal_nat_w.image);}
| compute_equal_quo_str=<QUOTEDSTRING>{System.out.print(compute_equal_quo_str.image);})
(
(compute_loop_op[i]=<PLUSCHAR>
| compute_loop_op[i]=<MINUSCHAR>
| compute_loop_op[i]=<ASTERISKCHAR>
| compute_loop_op[i]=<SLASHCHAR>) {System.out.print(compute_loop_op[i].image);}
( compute_loop_int_const[i]=<INTEGER_CONSTANT> {System.out.print(compute_loop_int_const[i].image);}
| (compute_loop_mem_type[i]=mem_type(){System.out.print(compute_loop_mem_type[i].image);})?
compute_loop_nat_w[i]=<NATURAL_WORD> {System.out.print(compute_loop_nat_w[i].image);}
) {i++;}
)* ("\r\n")?
{System.out.println();}
{ jjtThis.setCompute_mem_type1(compute_mem_type1);
jjtThis.setCompute_nat_w1(compute_nat_w1);
jjtThis.setCompute_equal(compute_equal);
jjtThis.setCompute_equal_int_const(compute_equal_int_const);
jjtThis.setCompute_equal_mem_type(compute_equal_mem_type);
jjtThis.setCompute_equal_nat_w(compute_equal_nat_w);
jjtThis.setCompute_equal_quo_str(compute_equal_quo_str);
jjtThis.setCompute_loop_op(compute_loop_op);
jjtThis.setCompute_loop_int_const(compute_loop_int_const);
jjtThis.setCompute_loop_mem_type(compute_loop_mem_type);
jjtThis.setCompute_loop_nat_w(compute_loop_nat_w);
jjtThis.setCompute_loop_i(i);
}
{ return jjtThis; }
}
ASTComputation ComputationStatement() #Computation:
{System.out.println();System.out.println("Computation statement");
Token comp_mem_type=null,comp_nat_w=null, comp_assign=null;
Token comp_assign_int_const=null, comp_assign_quo_str=null, comp_assign_mem_type=null, comp_assign_nat_w=null;}
{
(comp_mem_type=mem_type(){System.out.print(comp_mem_type.image);})?
comp_nat_w=<NATURAL_WORD> {System.out.print(comp_nat_w.image);}
comp_assign=<ASSIGNCHARS> {System.out.print(comp_assign.image);}
(
comp_assign_int_const=<INTEGER_CONSTANT> {System.out.print(comp_assign_int_const.image);}
| comp_assign_quo_str=<QUOTEDSTRING>{System.out.print(comp_assign_quo_str.image);}
| (
(comp_assign_mem_type=mem_type(){System.out.print(comp_assign_mem_type.image);})?
comp_assign_nat_w=<NATURAL_WORD>{System.out.print(comp_assign_nat_w.image);})
)
("\r\n")? {System.out.println();}
{
jjtThis.setComp_mem_type(comp_mem_type);
jjtThis.setComp_nat_w(comp_nat_w);
jjtThis.setComp_assign(comp_assign);
jjtThis.setComp_assign_int_const(comp_assign_int_const);
jjtThis.setComp_assign_quo_str(comp_assign_quo_str);
jjtThis.setComp_assign_mem_type(comp_assign_mem_type);
jjtThis.setComp_assign_nat_w(comp_assign_nat_w);
}
{ return jjtThis; }
}
ASTIf IfStatement() #If:
{System.out.println();System.out.println("If statement");
Token if_not=null, if_norec_fnd=null;
Token if_cnd_parm1_nat_w1=null, if_cnd_parm1_dot=null, if_cnd_parm1_mem_type=null, if_cnd_parm1_nat_w2=null;
Token if_cnd_parm1_lp=null;
Token if_cnd_parm1_paren_int_const=null,if_cnd_parm1_paren_quo_str=null, if_cnd_parm1_paren_mem_type=null, if_cnd_parm1_paren_nat_w=null;
Token if_cnd_parm1_rp=null;
Token if_cnd_cmpr=null;
Token[] if_cnd_parm2_paren_int_const=new Token[10],if_cnd_parm2_paren_quo_str=new Token[10], if_cnd_parm2_paren_mem_type=new Token[10], if_cnd_parm2_paren_nat_w=new Token[10];
Token if_cnd_parm2_paren_mask=null;
Token if_thru=null;
Token[] if_thru_int_const=new Token[10],if_thru_quo_str=new Token[10], if_thru_mem_type=new Token[10], if_thru_nat_w=new Token[10];
Token[] if_and=new Token[10], if_or=new Token[10];
Token[] if_and_mem_type=new Token[10], if_and_nat_w=new Token[10];
Token[] if_and_lp=new Token[10];
Token[] if_and_int_const1=new Token[10], if_and_quo_str1=new Token[10], if_and_mem_type1=new Token[10], if_and_paren_nat_w1=new Token[10];
Token[] if_and_rp=new Token[10];
Token[] if_and_cmpr=new Token[10];
Token[] if_and_int_const2=new Token[10],if_and_quo_str2=new Token[10], if_and_mem_type2=new Token[10], if_and_paren_nat_w2=new Token[10];
Token if_else=null;
Token if_endif=null;
int i=0,j=0,k=0;
}
{
<IF> {System.out.print("IF ");}("\r\n")? (if_not=<NOT> {System.out.print(if_not.image+" ");})? ("\r\n")?
(
(
if_norec_fnd=<NO_REC_FOUND>{System.out.print(if_norec_fnd.image+" ");}("\r\n")?
)
|
(
(
(
(if_cnd_parm1_nat_w1=<NATURAL_WORD>{System.out.print(if_cnd_parm1_nat_w1.image+" ");}
if_cnd_parm1_dot=<DOTCHAR>{System.out.print(if_cnd_parm1_dot.image+" ");})?
(if_cnd_parm1_mem_type=mem_type(){System.out.print(if_cnd_parm1_mem_type.image+" ");})?
if_cnd_parm1_nat_w2=<NATURAL_WORD>{System.out.print(if_cnd_parm1_nat_w2.image+" ");}
) ("\r\n")?
(
if_cnd_parm1_lp=<LPARENCHAR>{System.out.print(if_cnd_parm1_lp.image+" ");}
(
if_cnd_parm1_paren_int_const=<INTEGER_CONSTANT> {System.out.print(if_cnd_parm1_paren_int_const.image+" ");}
| if_cnd_parm1_paren_quo_str=<QUOTEDSTRING>{System.out.print(if_cnd_parm1_paren_quo_str.image+" ");}
| (if_cnd_parm1_paren_mem_type=mem_type(){System.out.print(if_cnd_parm1_paren_mem_type.image+" ");})?
if_cnd_parm1_paren_nat_w=<NATURAL_WORD>{System.out.print(if_cnd_parm1_paren_nat_w.image+" ");}
)
if_cnd_parm1_rp=<RPARENCHAR>{System.out.print(if_cnd_parm1_rp.image+" ");}
)? ("\r\n")?
(if_cnd_cmpr=compare() {System.out.print(if_cnd_cmpr.image+" ");})("\r\n")?
(
if_cnd_parm2_paren_mask=<MASK> {System.out.print(if_cnd_parm2_paren_mask.image+" ");}("\r\n")?
|
(
(if_cnd_parm2_paren_int_const[j]=<INTEGER_CONSTANT> {System.out.print(if_cnd_parm2_paren_int_const[j].image+" ");}
| if_cnd_parm2_paren_quo_str[j]=<QUOTEDSTRING>{System.out.print(if_cnd_parm2_paren_quo_str[j].image+" ");}
| (if_cnd_parm2_paren_mem_type[j]=mem_type(){System.out.print(if_cnd_parm2_paren_mem_type[j].image+" ");})?
if_cnd_parm2_paren_nat_w[j]=<NATURAL_WORD>{System.out.print(if_cnd_parm2_paren_nat_w[j].image+" ");})
{j++;}
)+ ("\r\n")?
)
)
(
if_thru=<THRU> {System.out.print(if_thru.image+" ");}
(
(if_thru_int_const[k]=<INTEGER_CONSTANT> {System.out.print(if_thru_int_const[k].image+" ");}
| if_thru_quo_str[k]=<QUOTEDSTRING> {System.out.print(if_thru_quo_str[k].image+" ");}
| (if_thru_mem_type[k]=mem_type() {System.out.print(if_thru_mem_type[k].image+" ");})?
if_thru_nat_w[k]=<NATURAL_WORD> {System.out.print(if_thru_nat_w[k].image+" ");})
{k++;}
)+
)? ("\r\n")?
( ("\r\n")?
(if_and[i]=<AND>{System.out.print(if_and[i].image+" ");} | if_or[i]=<OR>{System.out.print(if_or[i].image+" ");}) ("\r\n")?
((if_and_mem_type[i]=mem_type(){System.out.print(if_and_mem_type[i].image+" ");})?
if_and_nat_w[i]=<NATURAL_WORD>{System.out.print(if_and_nat_w[i].image+" ");})? ("\r\n")?
(if_and_lp[i]=<LPARENCHAR>{System.out.print(if_and_lp[i].image+" ");}
(
if_and_int_const1[i]=<INTEGER_CONSTANT> {System.out.print(if_and_int_const1[i].image+" ");}
| if_and_quo_str1[i]=<QUOTEDSTRING>{System.out.print(if_and_quo_str1[i].image+" ");}
| (if_and_mem_type1[i]=mem_type(){System.out.print(if_and_mem_type1[i].image+" ");})?
if_and_paren_nat_w1[i]=<NATURAL_WORD>{System.out.print(if_and_paren_nat_w1[i].image+" ");}
)
if_and_rp[i]=<RPARENCHAR>{System.out.print(if_and_rp[i].image+" ");}
)? ("\r\n")?
if_and_cmpr[i]=compare() {System.out.print(if_and_cmpr[i].image+" ");}("\r\n")?
(
if_and_int_const2[i]=<INTEGER_CONSTANT>{System.out.print(if_and_int_const2[i].image+" ");}
| if_and_quo_str2[i]=<QUOTEDSTRING> {System.out.print(if_and_quo_str2[i].image+" ");}
| (if_and_mem_type2[i]=mem_type(){System.out.print(if_and_mem_type2[i].image+" ");})?
if_and_paren_nat_w2[i]=<NATURAL_WORD>{System.out.print(if_and_paren_nat_w2[i].image+" ");}
)?
{i++;}
)*
) ("\r\n")?
)
{
jjtThis.setIf_not(if_not);
jjtThis.setIf_norec_fnd(if_norec_fnd);
jjtThis.setIf_cnd_parm1_nat_w1(if_cnd_parm1_nat_w1);
jjtThis.setIf_cnd_parm1_dot(if_cnd_parm1_dot);
jjtThis.setIf_cnd_parm1_mem_type(if_cnd_parm1_mem_type);
jjtThis.setIf_cnd_parm1_nat_w2(if_cnd_parm1_nat_w2);
jjtThis.setIf_cnd_parm1_lp(if_cnd_parm1_lp);
jjtThis.setIf_cnd_parm1_paren_int_const(if_cnd_parm1_paren_int_const);
jjtThis.setIf_cnd_parm1_paren_quo_str(if_cnd_parm1_paren_quo_str);
jjtThis.setIf_cnd_parm1_paren_mem_type(if_cnd_parm1_paren_mem_type);
jjtThis.setIf_cnd_parm1_paren_nat_w(if_cnd_parm1_paren_nat_w);
jjtThis.setIf_cnd_parm1_rp(if_cnd_parm1_rp);
jjtThis.setIf_cnd_cmpr(if_cnd_cmpr);
jjtThis.setIf_cnd_parm2_paren_int_const(if_cnd_parm2_paren_int_const);
jjtThis.setIf_cnd_parm2_paren_quo_str(if_cnd_parm2_paren_quo_str);
jjtThis.setIf_cnd_parm2_paren_mem_type(if_cnd_parm2_paren_mem_type);
jjtThis.setIf_cnd_parm2_paren_nat_w(if_cnd_parm2_paren_nat_w);
jjtThis.setIf_cnd_parm2_paren_mask(if_cnd_parm2_paren_mask);
jjtThis.setIf_thru(if_thru);
jjtThis.setIf_thru_int_const(if_thru_int_const);
jjtThis.setIf_thru_quo_str(if_thru_quo_str);
jjtThis.setIf_thru_mem_type(if_thru_mem_type);
jjtThis.setIf_thru_nat_w(if_thru_nat_w);
jjtThis.setIf_and(if_and);
jjtThis.setIf_or(if_or);
jjtThis.setIf_and_mem_type(if_and_mem_type);
jjtThis.setIf_and_nat_w(if_and_nat_w);
jjtThis.setIf_and_lp(if_and_lp);
jjtThis.setIf_and_int_const1(if_and_int_const1);
jjtThis.setIf_and_quo_str1(if_and_quo_str1);
jjtThis.setIf_and_mem_type1(if_and_mem_type1);
jjtThis.setIf_and_paren_nat_w1(if_and_paren_nat_w1);
jjtThis.setIf_and_rp(if_and_rp);
jjtThis.setIf_and_cmpr(if_and_cmpr);
jjtThis.setIf_and_int_const2(if_and_int_const2);
jjtThis.setIf_and_quo_str2(if_and_quo_str2);
jjtThis.setIf_and_mem_type2(if_and_mem_type2);
jjtThis.setIf_and_paren_nat_w2(if_and_paren_nat_w2);
jjtThis.setIf_i(i);
jjtThis.setIf_j(j);
jjtThis.setIf_k(k);
}
(NaturalStatement())*
(
if_else=<ELSE>{System.out.print(if_else.image+" ");}{jjtThis.setIf_else(if_else);} ("\r\n")?
(NaturalStatement())+
)*
EndIfStatement()
{System.out.println();}
{ return jjtThis; }
}
ASTEndIf EndIfStatement() #EndIf :
{System.out.println();System.out.println("End If statement");}
{
(<END_IF>{System.out.print("END-IF ");}) ("\r\n")?
{ return jjtThis; }
}
//MAIN UNIT
ASTStart Start () #Start:
{
System.out.println("Start");
}
{
(
CodeLine()
)*
<EOF>
{ return jjtThis; }
}