Skip to content
Snippets Groups Projects
Commit 8363ac04 authored by lucien.noel's avatar lucien.noel
Browse files

git cest de la merde

parent 21a1c816
No related branches found
No related tags found
No related merge requests found
/*
* Represent an equal comparaison expression node inside the AST.
*/
public class Diff extends Relation {
/**
* Constructor
*/
public Diff(Expression operandeGauche, Expression operandeDroite, String fl, int line, int col) {
super(operandeGauche, operandeDroite, fl, line, col);
}
/**
* Get the binary operator
*/
public String operateur() {
return "<>";
}
/**
* Accepts a AST visitor
*/
Object accept(ASTVisitor visitor){
return visitor.visit(this);
}
}
/*
* Represent an equal comparaison expression node inside the AST.
*/
public class InfEgal extends Relation {
/**
* Constructor
*/
public InfEgal(Expression operandeGauche, Expression operandeDroite, String fl, int line, int col) {
super(operandeGauche, operandeDroite, fl, line, col);
}
/**
* Get the binary operator
*/
public String operateur() {
return "<=";
}
/**
* Accepts a AST visitor
*/
Object accept(ASTVisitor visitor){
return visitor.visit(this);
}
}
/*
* Represent an equal comparaison expression node inside the AST.
*/
public class Inferieur extends Relation {
/**
* Constructor
*/
public Inferieur(Expression operandeGauche, Expression operandeDroite, String fl, int line, int col) {
super(operandeGauche, operandeDroite, fl, line, col);
}
/**
* Get the binary operator
*/
public String operateur() {
return "<";
}
/**
* Accepts a AST visitor
*/
Object accept(ASTVisitor visitor){
return visitor.visit(this);
}
}
/*
* Represent an equal comparaison expression node inside the AST.
*/
public class SupEgal extends Relation {
/**
* Constructor
*/
public SupEgal(Expression operandeGauche, Expression operandeDroite, String fl, int line, int col) {
super(operandeGauche, operandeDroite, fl, line, col);
}
/**
* Get the binary operator
*/
public String operateur() {
return "=<";
}
/**
* Accepts a AST visitor
*/
Object accept(ASTVisitor visitor){
return visitor.visit(this);
}
}
/*
* Represent an equal comparaison expression node inside the AST.
*/
public class Superieur extends Relation {
/**
* Constructor
*/
public Superieur(Expression operandeGauche, Expression operandeDroite, String fl, int line, int col) {
super(operandeGauche, operandeDroite, fl, line, col);
}
/**
* Get the binary operator
*/
public String operateur() {
return ">";
}
/**
* Accepts a AST visitor
*/
Object accept(ASTVisitor visitor){
return visitor.visit(this);
}
}
...@@ -2,5 +2,6 @@ programme Program ...@@ -2,5 +2,6 @@ programme Program
debutprg debutprg
c = c * 2; c = c * 2;
b = faux et vrai; b = 3;
d = c <> b;
finprg finprg
...@@ -23,7 +23,7 @@ public interface ASTVisitor { ...@@ -23,7 +23,7 @@ public interface ASTVisitor {
Object visit(DeclarationProgramme node); Object visit(DeclarationProgramme node);
// Object visit(DeclarationVariable node); // Object visit(DeclarationVariable node);
// Object visit(Diff node); Object visit(Diff node);
Object visit(Division node); Object visit(Division node);
// Object visit(Ecrire node); // Object visit(Ecrire node);
...@@ -34,8 +34,8 @@ public interface ASTVisitor { ...@@ -34,8 +34,8 @@ public interface ASTVisitor {
Object visit(Faux node); Object visit(Faux node);
Object visit(Idf node); Object visit(Idf node);
// Object visit(InfEgal node); Object visit(InfEgal node);
// Object visit(Inferieur node); Object visit(Inferieur node);
// Object visit(Lire node); // Object visit(Lire node);
// Object visit(Moins node); // Object visit(Moins node);
Object visit(Nombre node); Object visit(Nombre node);
...@@ -47,8 +47,8 @@ public interface ASTVisitor { ...@@ -47,8 +47,8 @@ public interface ASTVisitor {
Object visit(Produit node); Object visit(Produit node);
Object visit(Soustraction node); Object visit(Soustraction node);
// Object visit(SupEgal node); Object visit(SupEgal node);
// Object visit(Superieur node); Object visit(Superieur node);
// Object visit(Tantque node); // Object visit(Tantque node);
Object visit(Vrai node); Object visit(Vrai node);
} }
...@@ -34,7 +34,7 @@ public class ByteCodeGenerator implements ASTVisitor { ...@@ -34,7 +34,7 @@ public class ByteCodeGenerator implements ASTVisitor {
// public Object visit(DeclarationVariable node) { return null; } // public Object visit(DeclarationVariable node) { return null; }
// public Object visit(Diff node) { return null; } public Object visit(Diff node) { return null; }
public Object visit(Division node) { public Object visit(Division node) {
return null; return null;
...@@ -56,9 +56,9 @@ public class ByteCodeGenerator implements ASTVisitor { ...@@ -56,9 +56,9 @@ public class ByteCodeGenerator implements ASTVisitor {
return null; return null;
} }
// public Object visit(InfEgal node) { return null; } public Object visit(InfEgal node) { return null; }
// public Object visit(Inferieur node) { return null; } public Object visit(Inferieur node) { return null; }
// public Object visit(Lire node) { return null; } // public Object visit(Lire node) { return null; }
...@@ -86,9 +86,9 @@ public class ByteCodeGenerator implements ASTVisitor { ...@@ -86,9 +86,9 @@ public class ByteCodeGenerator implements ASTVisitor {
return null; return null;
} }
// public Object visit(SupEgal node) { return null; } public Object visit(SupEgal node) { return null; }
// public Object visit(Superieur node) { return null; } public Object visit(Superieur node) { return null; }
// public Object visit(Tantque node) { return null; } // public Object visit(Tantque node) { return null; }
......
...@@ -36,7 +36,7 @@ public class SemanticAnalyzer implements ASTVisitor { ...@@ -36,7 +36,7 @@ public class SemanticAnalyzer implements ASTVisitor {
// public Object visit(DeclarationVariable node) { return null; } // public Object visit(DeclarationVariable node) { return null; }
// public Object visit(Diff node) { return null; } public Object visit(Diff node) { return null; }
public Object visit(Division node) { public Object visit(Division node) {
return null; return null;
...@@ -58,9 +58,9 @@ public class SemanticAnalyzer implements ASTVisitor { ...@@ -58,9 +58,9 @@ public class SemanticAnalyzer implements ASTVisitor {
return null; return null;
} }
// public Object visit(InfEgal node) { return null; } public Object visit(InfEgal node) { return null; }
// public Object visit(Inferieur node) { return null; } public Object visit(Inferieur node) { return null; }
// public Object visit(Lire node) { return null; } // public Object visit(Lire node) { return null; }
...@@ -88,9 +88,9 @@ public class SemanticAnalyzer implements ASTVisitor { ...@@ -88,9 +88,9 @@ public class SemanticAnalyzer implements ASTVisitor {
return null; return null;
} }
// public Object visit(SupEgal node) { return null; } public Object visit(SupEgal node) { return null; }
// public Object visit(Superieur node) { return null; } public Object visit(Superieur node) { return null; }
// public Object visit(Tantque node) { return null; } // public Object visit(Tantque node) { return null; }
......
...@@ -117,14 +117,14 @@ public class SourceCodeGenerator implements ASTVisitor { ...@@ -117,14 +117,14 @@ public class SourceCodeGenerator implements ASTVisitor {
// code += ";"; // code += ";";
// return null; // return null;
// } // }
//
// public Object visit(Diff node){ public Object visit(Diff node){
// node.getGauche().accept(this); node.getGauche().accept(this);
// code += " <> "; code += " <> ";
// node.getDroite().accept(this); node.getDroite().accept(this);
// return null; return null;
// } }
//
public Object visit(Division node) { public Object visit(Division node) {
node.getGauche().accept(this); node.getGauche().accept(this);
code += " / "; code += " / ";
...@@ -163,20 +163,20 @@ public class SourceCodeGenerator implements ASTVisitor { ...@@ -163,20 +163,20 @@ public class SourceCodeGenerator implements ASTVisitor {
return null; return null;
} }
// public Object visit(InfEgal node){ public Object visit(InfEgal node){
// node.getGauche().accept(this); node.getGauche().accept(this);
// code += " <= "; code += " <= ";
// node.getDroite().accept(this); node.getDroite().accept(this);
// return null; return null;
// } }
//
// public Object visit(Inferieur node){ public Object visit(Inferieur node){
// node.getGauche().accept(this); node.getGauche().accept(this);
// code += " < "; code += " < ";
// node.getDroite().accept(this); node.getDroite().accept(this);
// return null; return null;
// } }
//
// public Object visit(Lire node){ // public Object visit(Lire node){
// code += "lire "; // code += "lire ";
// node.getDestination().accept(this); // node.getDestination().accept(this);
...@@ -245,21 +245,21 @@ public class SourceCodeGenerator implements ASTVisitor { ...@@ -245,21 +245,21 @@ public class SourceCodeGenerator implements ASTVisitor {
node.getDroite().accept(this); node.getDroite().accept(this);
return null; return null;
} }
//
// public Object visit(SupEgal node){ public Object visit(SupEgal node){
// node.getGauche().accept(this); node.getGauche().accept(this);
// code += " >= "; code += " >= ";
// node.getDroite().accept(this); node.getDroite().accept(this);
// return null; return null;
// } }
//
// public Object visit(Superieur node){ public Object visit(Superieur node){
// node.getGauche().accept(this); node.getGauche().accept(this);
// code += " > "; code += " > ";
// node.getDroite().accept(this); node.getDroite().accept(this);
// return null; return null;
// } }
//
// public Object visit(Tantque node){ // public Object visit(Tantque node){
// code += "tantque "; // code += "tantque ";
// node.getCondition().accept(this); // node.getCondition().accept(this);
......
...@@ -83,11 +83,11 @@ op_bin ::= expr:a PLUS expr:b {: RESULT = new Addition(a, b, "", a ...@@ -83,11 +83,11 @@ op_bin ::= expr:a PLUS expr:b {: RESULT = new Addition(a, b, "", a
| expr:a OR expr:b {: RESULT = new Ou(a, b, "", aleft, aright);:}; | expr:a OR expr:b {: RESULT = new Ou(a, b, "", aleft, aright);:};
relation ::= expr:a EQUALS expr:b {: RESULT = new Egal(a, b, "", aleft, aright); :} relation ::= expr:a EQUALS expr:b {: RESULT = new Egal(a, b, "", aleft, aright); :}
| expr DIFF expr {: :} |expr:a DIFF expr:b {: RESULT = new Diff(a, b, "", aleft, aright); :}
| expr INF expr {: :} | expr:a INF expr:b {: RESULT = new Inferieur(a, b, "", aleft, aright); :}
| expr SUP expr {: :} | expr:a SUP expr:b {: RESULT = new Superieur(a, b, "", aleft, aright); :}
| expr INFEQUAL expr {: :} | expr:a INFEQUAL expr:b {: RESULT = new InfEgal(a, b, "", aleft, aright); :}
| expr SUPEQUAL expr {: :}; | expr:a SUPEQUAL expr:b {: RESULT = new SupEgal(a, b, "", aleft, aright); :};
op_una ::= NOT expr {: :} op_una ::= NOT expr {: :}
| MINUS expr {: :} | MINUS expr {: :}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment