-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Traductor | ||
Proyecto para la materia traductores de lenguajes 2 UDG CUCEI | ||
|
||
La gramatica que aceptad de entrada son las siguientes sentencias | ||
|
||
Asignacion: | ||
ID = "cadena"; | ||
ID = REAL + REAL - REAL * REAL / (REAL % REAL); | ||
ID = ENTERO + ENTERO - ENTERO * ENTERO / (ENTERO % ENTERO); | ||
|
||
Tambien acepta ID's en la expresión mientras sean del mismo tipo. | ||
Los numeros pueden ser negativos | ||
|
||
Print: | ||
print(ID); | ||
print(expresión); //Como las expresiónes que use en los ejemplos de asignacion | ||
print("cadena"); | ||
|
||
If: | ||
if(condicion) | ||
{ | ||
sentencia | ||
} | ||
else | ||
{ | ||
|
||
} | ||
|
||
puede ser cualquier cantidad de sentencias (tambien 0) | ||
puede no llevar llaves pero solo acepta una sentencia | ||
la condicion es una expresión seguida de un simbolo comparativo y otra expresion despues. | ||
Los simbolos comparativos que acepta son: | ||
<, >, <=, >=, ==, != | ||
|
||
else es opcional. | ||
else tambien puede usarse sin llaves, aceptando solo una sentencia. | ||
|
||
While: | ||
while(condicion) | ||
{ | ||
|
||
} | ||
|
||
Recibe una condicion de la misma manera que la sentencia if. | ||
Al igual que la sentencia if puede llevar 0 o muchas sentencias, o una sentencia si no se ponen llaves. |