You are on page 1of 1

IF::=prif CONDICION:c prthen prend prif {:RESULT="if("+c.

toString()+"){\n}";:}
|prif CONDICION:c prthen prelse prend prif {:RESULT="if("+c.toString()+")
{\n}\nelse{\n}";:}
|prif CONDICION:c prthen ELSEIF:eif prend prif {:RESULT="if("+c.toString()+")
{\n}\n"+eif.toString();:}
|prif CONDICION:c prthen SENTENCIASIF:si prelse prend prif
{:RESULT="if("+c.toString()+"){\n"+si.toString()+"}\n else{\n}";:}
|prif CONDICION:c prthen prelse SENTENCIASIF:si prend prif
{:RESULT="if("+c.toString()+"){\n}\n else{\n"+si.toString()+"}";:}
|prif CONDICION:c prthen SENTENCIASIF:si prend prif {:RESULT="if("+c.toString()
+"){\n"+si.toString()+"}";:}
|prif CONDICION:c prthen SENTENCIASIF:si prelse SENTENCIASIF:so prend prif
{:RESULT="if("+c.toString()+"){\n"+si.toString()+"}\nelse{\n"+so.toString()
+"}";:};

ELSEIF::=prelseif CONDICION:c prthen ELSEIF:id {:RESULT="else if("+c.toString()+")


{\n}\n"+id.toString();:}
|prelseif CONDICION:c prthen {:RESULT="else if("+c.toString()+"){\n}";:}
|prelseif CONDICION:c prthen prelse {:RESULT="else if("+c.toString()+")
{\n}\nelse{\n}";:}
|prelseif CONDICION:c prthen SENTENCIASIF:si ELSEIF:id {:RESULT="else
if("+c.toString()+"){\n"+si.toString()+"}\n"+id.toString();:}
|prelseif CONDICION:c prthen SENTENCIASIF:si {:RESULT="else if("+c.toString()
+"){\n"+si.toString()+"}";:}
|prelseif CONDICION:c prthen SENTENCIASIF:si prelse {:RESULT="else
if("+c.toString()+"){\n"+si.toString()+"}\nelse{\n}";:}
|prelseif CONDICION:c prthen prelse SENTENCIASIF:si {:RESULT="else
if("+c.toString()+"){\n}\nelse{\n"+si.toString()+"}";:}
|prelseif CONDICION:c prthen SENTENCIASIF:si prelse SENTENCIASIF:so
{:RESULT="else if("+c.toString()+"){\n"+si.toString()
+"}\nelse{\n"+si.toString()+"}";:};

SENTENCIASIF::=escr_consola par1 VALOR:m par2


{:RESULT="System.out.print("+m+")"; :}
|escrln_consola par1 VALOR:m par2 {:RESULT="System.out.println("+m+")"; :};

//******
CONDICION::= VALOR:v SIGNCOMPA:p VALOR:b NEXOLOG:n CONDICION:c
{:RESULT=v.toString()+p.toString()+b.toString()+n.toString()+c.toString();:}
|VALOR:v SIGNCOMPA:p VALOR:b {:RESULT=v.toString()+p.toString()
+b.toString();:};

NEXOLOG::=prand {:RESULT="&&"; :}
|pror {:RESULT="||"; :}
|prnot {:RESULT="!"; :};

SIGNCOMPA::=mayor {:RESULT=">"; :}
|menor {:RESULT="<"; :}
|mayorigual {:RESULT=">="; :}
|menorigual {:RESULT="<="; :}
|igual {:RESULT="=="; :}
|diferente {:RESULT="!="; :};

VALOR::=decimal:val {:RESULT=val; :}
|entero:val {:RESULT=val; :}
|id:val {:RESULT=val; :}
|cadena:val {:RESULT=val; :}
|LLAMARFUNCION:val {:RESULT=val; :}
|LLAMARARREGLO:val {:RESULT=val; :};

You might also like