Skip to content

Commit

Permalink
alteração na Gramatica do GALS e Implementação da interpretação da li…
Browse files Browse the repository at this point in the history
…nguagem
  • Loading branch information
aismaniotto committed Oct 4, 2016
1 parent 1bfdf6d commit de022c5
Show file tree
Hide file tree
Showing 14 changed files with 132 additions and 84 deletions.
Binary file not shown.
Binary file modified fyja-game-language/build/classes/gals/ParserConstants.class
Binary file not shown.
Binary file modified fyja-game-language/build/classes/gals/Semantico.class
Binary file not shown.
Binary file modified fyja-game-language/build/classes/interpretador/Comando.class
Binary file not shown.
Binary file modified fyja-game-language/build/classes/interpretador/Interpretador.class
Binary file not shown.
2 changes: 1 addition & 1 deletion fyja-game-language/nbproject/private/private.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
compile.on.save=true
user.properties.file=C:\\Users\\jean_\\AppData\\Roaming\\NetBeans\\8.1\\build.properties
user.properties.file=C:\\Users\\Andr\u00e9\\AppData\\Roaming\\NetBeans\\8.1\\build.properties
7 changes: 7 additions & 0 deletions fyja-game-language/nbproject/private/private.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group/>
</open-files>
</project-private>
12 changes: 10 additions & 2 deletions fyja-game-language/src/fyja/game/language/FyjaGameLanguage.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,25 @@
*/
package fyja.game.language;

import interpretador.Interpretador;

/**
*
* @author jean_
* @author jean_gayzinho
*/
public class FyjaGameLanguage {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Interpretador interpretador = new Interpretador();
String fonte = "INICIO " +
"ANDAR 20 PARA SUL " +
"NADAR 10 PARA NORTE " +
"FIM";
interpretador.interpretar(fonte);

}

}
58 changes: 31 additions & 27 deletions fyja-game-language/src/gals/ParserConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,32 @@ public interface ParserConstants

int[][][] PARSER_TABLE =
{
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {SHIFT , 2}, {ERROR , 0}, {GO_TO , 1}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ACCEPT, 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {SHIFT , 5}, {ERROR , 0}, {SHIFT , 6}, {SHIFT , 7}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {GO_TO , 3}, {GO_TO , 4}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {SHIFT , 5}, {ERROR , 0}, {SHIFT , 6}, {SHIFT , 7}, {ERROR , 0}, {SHIFT , 8}, {ERROR , 0}, {ERROR , 0}, {GO_TO , 9}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {REDUCE, 2}, {ERROR , 0}, {REDUCE, 2}, {REDUCE, 2}, {ERROR , 0}, {REDUCE, 2}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {SHIFT , 11}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {GO_TO , 10}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {SHIFT , 11}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {GO_TO , 12}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {SHIFT , 11}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {GO_TO , 13}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {REDUCE, 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {REDUCE, 1}, {ERROR , 0}, {REDUCE, 1}, {REDUCE, 1}, {ERROR , 0}, {REDUCE, 1}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {SHIFT , 14}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ACTION, 1}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {GO_TO , 15}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {SHIFT , 16}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {SHIFT , 17}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {SHIFT , 19}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {GO_TO , 18}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {REDUCE, 6}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {SHIFT , 19}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {GO_TO , 20}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {SHIFT , 19}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {GO_TO , 21}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ACTION, 2}, {ERROR , 0}, {ACTION, 2}, {ACTION, 2}, {ERROR , 0}, {ACTION, 2}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {GO_TO , 22}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ACTION, 3}, {ERROR , 0}, {ACTION, 3}, {ACTION, 3}, {ERROR , 0}, {ACTION, 3}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {GO_TO , 23}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {REDUCE, 4}, {ERROR , 0}, {REDUCE, 4}, {REDUCE, 4}, {ERROR , 0}, {REDUCE, 4}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {REDUCE, 5}, {ERROR , 0}, {REDUCE, 5}, {REDUCE, 5}, {ERROR , 0}, {REDUCE, 5}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {REDUCE, 3}, {ERROR , 0}, {REDUCE, 3}, {REDUCE, 3}, {ERROR , 0}, {REDUCE, 3}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {REDUCE, 7}, {ERROR , 0}, {REDUCE, 7}, {REDUCE, 7}, {ERROR , 0}, {REDUCE, 7}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} }
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {SHIFT , 2}, {ERROR , 0}, {GO_TO , 1}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ACCEPT, 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {SHIFT , 5}, {ERROR , 0}, {SHIFT , 6}, {SHIFT , 7}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {GO_TO , 3}, {GO_TO , 4}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {SHIFT , 5}, {ERROR , 0}, {SHIFT , 6}, {SHIFT , 7}, {ERROR , 0}, {SHIFT , 8}, {ERROR , 0}, {ERROR , 0}, {GO_TO , 9}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {REDUCE, 2}, {ERROR , 0}, {REDUCE, 2}, {REDUCE, 2}, {ERROR , 0}, {REDUCE, 2}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {SHIFT , 11}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {GO_TO , 10}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {SHIFT , 11}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {GO_TO , 12}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {SHIFT , 11}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {GO_TO , 13}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {REDUCE, 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {REDUCE, 1}, {ERROR , 0}, {REDUCE, 1}, {REDUCE, 1}, {ERROR , 0}, {REDUCE, 1}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {SHIFT , 14}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ACTION, 4}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {GO_TO , 15}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {SHIFT , 16}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {SHIFT , 17}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {SHIFT , 19}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {GO_TO , 18}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {REDUCE, 6}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {SHIFT , 19}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {GO_TO , 20}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {SHIFT , 19}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {GO_TO , 21}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ACTION, 1}, {ERROR , 0}, {ACTION, 1}, {ACTION, 1}, {ERROR , 0}, {ACTION, 1}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {GO_TO , 22}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ACTION, 5}, {ERROR , 0}, {ACTION, 5}, {ACTION, 5}, {ERROR , 0}, {ACTION, 5}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {GO_TO , 23}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ACTION, 2}, {ERROR , 0}, {ACTION, 2}, {ACTION, 2}, {ERROR , 0}, {ACTION, 2}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {GO_TO , 24}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ACTION, 3}, {ERROR , 0}, {ACTION, 3}, {ACTION, 3}, {ERROR , 0}, {ACTION, 3}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {GO_TO , 25}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {REDUCE, 3}, {ERROR , 0}, {REDUCE, 3}, {REDUCE, 3}, {ERROR , 0}, {REDUCE, 3}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {REDUCE, 7}, {ERROR , 0}, {REDUCE, 7}, {REDUCE, 7}, {ERROR , 0}, {REDUCE, 7}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {REDUCE, 4}, {ERROR , 0}, {REDUCE, 4}, {REDUCE, 4}, {ERROR , 0}, {REDUCE, 4}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} },
{ {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {REDUCE, 5}, {ERROR , 0}, {REDUCE, 5}, {REDUCE, 5}, {ERROR , 0}, {REDUCE, 5}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0}, {ERROR , 0} }
};

int[][] PRODUCTIONS =
Expand All @@ -45,8 +47,8 @@ public interface ParserConstants
{ 11, 2 },
{ 11, 1 },
{ 12, 5 },
{ 12, 4 },
{ 12, 4 },
{ 12, 5 },
{ 12, 5 },
{ 13, 2 },
{ 14, 2 }
};
Expand Down Expand Up @@ -76,6 +78,8 @@ public interface ParserConstants
"Erro estado 20",
"Erro estado 21",
"Erro estado 22",
"Erro estado 23"
"Erro estado 23",
"Erro estado 24",
"Erro estado 25"
};
}
26 changes: 21 additions & 5 deletions fyja-game-language/src/gals/Semantico.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,33 @@ public class Semantico implements Constants
{
public void executeAction(int action, Token token) throws SemanticError
{
//Interpretador.comandos.add(new Comando(Comando.Acoes.Andar, Comando.Direcoes.Norte, 10));

switch(action){
case 1:
System.out.println("1: " + token.getLexeme());
Interpretador.fila.add(Comando.Acoes.Andar);
Interpretador.comandos.add(new Comando((int)Interpretador.fila.poll(),
(String)Interpretador.fila.poll(),
(Comando.Acoes) Interpretador.fila.poll()
));
break;
case 2:
System.out.println("2: " + token.getLexeme());
Interpretador.fila.add(Comando.Acoes.Pular);
Interpretador.comandos.add(new Comando((int)Interpretador.fila.poll(),
(String)Interpretador.fila.poll(),
(Comando.Acoes) Interpretador.fila.poll()
));
break;
case 3:
System.out.println("3: " + token.getLexeme());
Interpretador.fila.add(Comando.Acoes.Nadar);
Interpretador.comandos.add(new Comando((int)Interpretador.fila.poll(),
(String)Interpretador.fila.poll(),
(Comando.Acoes) Interpretador.fila.poll()
));
break;
case 4:
Interpretador.fila.add(Integer.parseInt(token.getLexeme()));
break;
case 5:
Interpretador.fila.add(token.getLexeme());
break;
}
}
Expand Down
29 changes: 18 additions & 11 deletions fyja-game-language/src/interpretador/Comando.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,28 @@

/**
*
* @author jean_
* @author jean_arrombadinho
*/
public class Comando {
public enum Acoes {
Andar, Pular, Nadar;
}

public enum Direcoes {
/*public enum Direcoes {
Norte, Sul, Leste, Oeste;
}

public Comando(Acoes acao, Direcoes direcao, int quantidadePassos) {

}
}*/

private Acoes acao;
private Direcoes direcao;
private String direcao;
private int quantidadePassos;

public Comando( int quantidadePassos, String direcao, Acoes acao) {
this.acao = acao;
this.direcao = direcao;
this.quantidadePassos = quantidadePassos;

}

public Acoes getAcao() {
return acao;
}
Expand All @@ -34,11 +37,11 @@ public void setAcao(Acoes acao) {
this.acao = acao;
}

public Direcoes getDirecao() {
return direcao;
public String getDirecao() {
return this.direcao;
}

public void setDirecao(Direcoes direcao) {
public void setDirecao(String direcao) {
this.direcao = direcao;
}

Expand All @@ -49,4 +52,8 @@ public int getQuantidadePassos() {
public void setQuantidadePassos(int quantidadePassos) {
this.quantidadePassos = quantidadePassos;
}

public void printComando(){
System.out.println(this.acao+ " " + this.quantidadePassos + " para " + this.direcao);
}
}
Loading

0 comments on commit de022c5

Please sign in to comment.