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

commit init

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 1080 additions and 0 deletions
x: {2..0}
2
1
0
x: 2^{0..6}
1
2
4
8
16
32
64
x: {0..y}, y=3
0
1
2
3
programme Program
entier x;
entier y;
debutprg
x = 2;
ecrire "x: {2..0}";
tantque x >= 0 faire
ecrire x;
x = x - 1;
fintantque
ecrire "x: 2^{0..6}";
x = 1;
tantque x <= 64 faire
ecrire x;
x = x + x;
fintantque
x = 0;
y = 3;
ecrire "x: {0..y}, y=3";
tantque x <= y faire
ecrire x;
x = x + 1;
fintantque
finprg
.class public Program
.super java/lang/Object
.method public static main([Ljava/lang/String;)V
.limit stack 20000
.limit locals 3
.var 0 is x I
ldc 0
istore 0
.var 1 is y I
ldc 0
istore 1
getstatic java/lang/System/out Ljava/io/PrintStream;
ldc "::: loop0"
invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
ldc 0
istore 0
label_0:
ldc 10
iload 0
if_icmplt label_1
getstatic java/lang/System/out Ljava/io/PrintStream;
iload 0
invokevirtual java/io/PrintStream/println(I)V
iload 0
ldc 1
iadd
istore 0
goto label_0
label_1:
getstatic java/lang/System/out Ljava/io/PrintStream;
ldc "::: loop1"
invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
ldc 4
istore 1
ldc 1
istore 0
label_2:
iload 1
iload 0
if_icmplt label_3
getstatic java/lang/System/out Ljava/io/PrintStream;
iload 0
invokevirtual java/io/PrintStream/println(I)V
iload 0
ldc 1
iadd
istore 0
goto label_2
label_3:
getstatic java/lang/System/out Ljava/io/PrintStream;
ldc "::: loop2"
invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
ldc 1
istore 0
label_4:
ldc 10
iload 0
if_icmplt label_5
iload 0
ldc 1
iadd
istore 0
getstatic java/lang/System/out Ljava/io/PrintStream;
iload 0
invokevirtual java/io/PrintStream/println(I)V
iload 0
ldc 1
iadd
istore 0
goto label_4
label_5:
exit_label:
return
.end method
programme Program
entier x, y;
debutprg
ecrire "::: loop0";
pour x allantde 0 a 10 faire
ecrire x;
finpour
ecrire "::: loop1";
y = 4;
pour x allantde 1 a y faire
ecrire x;
finpour
ecrire "::: loop2";
pour x allantde 1 a 10 faire
x = x + 1;
ecrire x;
finpour
finprg
::: loop0
0
1
2
3
4
5
6
7
8
9
10
::: loop1
1
2
3
4
::: loop2
2
4
6
8
10
programme Program
entier x;
entier y;
debutprg
ecrire "::: loop0";
pour x allantde 0 a 10 faire
ecrire x;
finpour
ecrire "::: loop1";
y = 4;
pour x allantde 1 a y faire
ecrire x;
finpour
ecrire "::: loop2";
pour x allantde 1 a 10 faire
x = x + 1;
ecrire x;
finpour
finprg
.class public Program
.super java/lang/Object
.method public static main([Ljava/lang/String;)V
.limit stack 20000
.limit locals 2
.var 0 is x I
ldc 0
istore 0
getstatic java/lang/System/out Ljava/io/PrintStream;
ldc "Enter a number:"
invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
new java/util/Scanner
dup
getstatic java/lang/System/in Ljava/io/InputStream;
invokespecial java/util/Scanner/<init>(Ljava/io/InputStream;)V
invokevirtual java/util/Scanner/nextInt()I
istore 0
getstatic java/lang/System/out Ljava/io/PrintStream;
ldc "Next int:"
invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
getstatic java/lang/System/out Ljava/io/PrintStream;
iload 0
ldc 1
iadd
invokevirtual java/io/PrintStream/println(I)V
exit_label:
return
.end method
programme Program
entier x;
debutprg
ecrire "Enter a number:";
lire x;
ecrire "Next int:";
ecrire x + 1;
finprg
Enter a number:
Next int:
1235
programme Program
entier x;
debutprg
ecrire "Enter a number:";
lire x;
ecrire "Next int:";
ecrire x + 1;
finprg
1234
\ No newline at end of file
programme Program
debutprg
b = 3;
c = c + 2;
finprg
/*
* AST visiteur interface
*/
import java.util.*;
// TODO: Créez votre projet en vous basant sur cette liste de classes à créer OU adaptez cette interface en fonction de vos classes
// HINT:
// - Il peut y avoir des classes supplémentaire à développer. Par example les classes "intermédiaire" que sont Binaire ou Arithmetique ne sont pas présente dans cette liste
// - Les lignes non commentées sont les classes que nous vous avons déjà fourni.
// - Au fur à mesure du développement des classes, décommentez les fonctions "visit" correspondantes. Faites le également dans les classes implémentant cette interface
public interface ASTVisitor {
Object visit(Addition node);
Object visit(Affectation node);
Object visit(Bloc node);
Object visit(Chaine node);
// Object visit(Condition node);
// Object visit(DeclarationConstant node);
Object visit(DeclarationProgramme node);
// Object visit(DeclarationVariable node);
// Object visit(Diff node);
// Object visit(Division node);
// Object visit(Ecrire node);
Object visit(Egal node);
// Object visit(Et node);
// Object visit(Faux node);
Object visit(Idf node);
// Object visit(InfEgal node);
// Object visit(Inferieur node);
// Object visit(Lire node);
// Object visit(Moins node);
Object visit(Nombre node);
// Object visit(Non node);
// Object visit(Ou node);
// Object visit(Parentheses node);
// Object visit(Pour node);
// Object visit(Produit node);
// Object visit(Soustraction node);
// Object visit(SupEgal node);
// Object visit(Superieur node);
// Object visit(Tantque node);
// Object visit(Vrai node);
}
/*
* Generates the Jasmin byte code from an AST instance
*/
import java.util.*;
// TODO: A vous de jouer...
// Voir la documentation : GenCod.pdf
public class ByteCodeGenerator implements ASTVisitor{
public Object visit(Addition node) { return null; }
public Object visit(Affectation node) { return null; }
public Object visit(Bloc node) { return null; }
public Object visit(Chaine node) { return null; }
// public Object visit(Condition node) { return null; }
// public Object visit(DeclarationConstant node) { return null; }
public Object visit(DeclarationProgramme node) { return null; }
// public Object visit(DeclarationVariable node) { return null; }
// public Object visit(Diff node) { return null; }
// public Object visit(Division node) { return null; }
// public Object visit(Ecrire node) { return null; }
public Object visit(Egal node) { return null; }
// public Object visit(Et node) { return null; }
// public Object visit(Faux node) { return null; }
public Object visit(Idf node) { return null; }
// public Object visit(InfEgal node) { return null; }
// public Object visit(Inferieur node) { return null; }
// public Object visit(Lire node) { return null; }
// public Object visit(Moins node) { return null; }
public Object visit(Nombre node) { return null; }
// public Object visit(Non node) { return null; }
// public Object visit(Ou node) { return null; }
// public Object visit(Parentheses node) { return null; }
// public Object visit(Pour node) { return null; }
// public Object visit(Produit node) { return null; }
// public Object visit(Relation node) { return null; }
// public Object visit(Soustraction node) { return null; }
// public Object visit(SupEgal node) { return null; }
// public Object visit(Superieur node) { return null; }
// public Object visit(Tantque node) { return null; }
// public Object visit(Unaire node) { return null; }
// public Object visit(Vrai node) { return null; }
// TODO: Remplacez le return, celui-ci n'est là que pour ne pas provoquer une erreur de Jasmin quand le bytecode est vide.
public String getByteCode(){
return """
.class public Program
.super java/lang/Object
.method public static main([Ljava/lang/String;)V
.limit stack 20000
.limit locals 1
return
.end method
""";
}
}
/*
* Semantic analyser that walks the AST.
* Check for scope and type compatibility.
*/
// TODO: A vous de jouer...
// L'analyse sémantique dans notre projet (dans un vrai langage c'est plus conséquent) consiste à tester les choses suivantes :
// 1. Lors de l'utilisation d'une variable (ou de son affectation), vérifiez son existence (HINT: la TDS peut être utile...)
// 2. Vérification de la concordance des types (on affecte pas un boolean à un int, on additionne pas un boolean avec un int, on attends un boolean dans le test d'un if et pas autre chose, etc.)
// 3. Vérifiez qu'il n'y a pas de modification de la valeur des constantes
public class SemanticAnalyzer implements ASTVisitor {
public Object visit(Addition node) { return null; }
public Object visit(Affectation node) { return null; }
public Object visit(Bloc node) { return null; }
public Object visit(Chaine node) { return null; }
// public Object visit(Condition node) { return null; }
// public Object visit(DeclarationConstant node) { return null; }
public Object visit(DeclarationProgramme node) { return null; }
// public Object visit(DeclarationVariable node) { return null; }
// public Object visit(Diff node) { return null; }
// public Object visit(Division node) { return null; }
// public Object visit(Ecrire node) { return null; }
public Object visit(Egal node) { return null; }
// public Object visit(Et node) { return null; }
// public Object visit(Faux node) { return null; }
public Object visit(Idf node) { return null; }
// public Object visit(InfEgal node) { return null; }
// public Object visit(Inferieur node) { return null; }
// public Object visit(Lire node) { return null; }
// public Object visit(Moins node) { return null; }
public Object visit(Nombre node) { return null; }
// public Object visit(Non node) { return null; }
// public Object visit(Ou node) { return null; }
// public Object visit(Parentheses node) { return null; }
// public Object visit(Pour node) { return null; }
// public Object visit(Produit node) { return null; }
// public Object visit(Relation node) { return null; }
// public Object visit(Soustraction node) { return null; }
// public Object visit(SupEgal node) { return null; }
// public Object visit(Superieur node) { return null; }
// public Object visit(Tantque node) { return null; }
// public Object visit(Unaire node) { return null; }
// public Object visit(Vrai node) { return null; }
}
/*
* Source code generator that walks the AST and generates code source from the AST
*/
import java.util.*;
// TODO: Décommentez / Adaptez au fur à mesure de la création de vos classes les parties correspondantes.
// HINT: Vous pouvez vous aider du code commenté afin d'identifier le contenu possible de vos classes.
public class SourceCodeGenerator implements ASTVisitor{
/**
* Generated code
*/
private String code = "";
/**
* Depth level (tabulations)
*/
private int level = 0;
/**
* If we are currently declaring function parameters
*/
private boolean isParameterDeclaration = false;
/**
* Adds tabulation with current level
*/
private void addTabulation(){
addTabulation(level);
}
/**
* Adds tabulation with spacified level
*/
private void addTabulation(int level){
for (int i = 0;i < level; i++)
code += " ";
}
public Object visit(Addition node){
node.getGauche().accept(this);
code += " + ";
node.getDroite().accept(this);
return null;
}
public Object visit(Affectation node){
node.getDestination().accept(this);
code += " = ";
node.getSource().accept(this);
code += ";";
return null;
}
public Object visit(Bloc node){
for (Instruction inst: node.getInstructions()){
code += "\n";
addTabulation();
inst.accept(this);
}
return null;
}
public Object visit(Chaine node){
code += node.getValeur();
return null;
}
// public Object visit(Condition node){
// code += "si ";
// node.getCondition().accept(this);
// code += " alors";
// level += 1;
// node.getThenInstruction().accept(this);
// if (node.hasElse()){
// code += "\n";
// addTabulation(level - 1);
// code += "sinon";
// node.getElseInstruction().accept(this);
// }
// level -= 1;
// code += "\n";
// addTabulation();
// code += "finsi";
// return null;
// }
//
// public Object visit(DeclarationConstant node){
// Symbole sym = TDS.getInstance().identifier(new Entree(node.getIdentifier().getNom()));
//
// code += sym + " ";
// node.getIdentifier().accept(this);
// code += " = ";
// node.getConstantExpression().accept(this);
// code += ";";
// return null;
// }
public Object visit(DeclarationProgramme node){
code += "programme ";
// node.getIdentifier().accept(this);
// node.getDeclaration().accept(this);
code += "\ndebutprg";
node.getInstructions().accept(this);
code += "\nfinprg";
return null;
}
// public Object visit(DeclarationVariable node){
// Symbole sym = TDS.getInstance().identifier(new Entree(node.getIdentifier().getNom()));
//
// code += sym + " ";
// node.getIdentifier().accept(this);
// if (!isParameterDeclaration)
// code += ";";
// return null;
// }
//
// public Object visit(Diff node){
// node.getGauche().accept(this);
// code += " <> ";
// node.getDroite().accept(this);
// return null;
// }
//
// public Object visit(Division node){
// node.getGauche().accept(this);
// code += " / ";
// node.getDroite().accept(this);
// return null;
// }
//
// public Object visit(Ecrire node){
// code += "ecrire ";
// node.getSource().accept(this);
// code += ";";
// return null;
// }
public Object visit(Egal node){
node.getGauche().accept(this);
code += " == ";
node.getDroite().accept(this);
return null;
}
// public Object visit(Et node){
// node.getGauche().accept(this);
// code += " et ";
// node.getDroite().accept(this);
// return null;
// }
//
// public Object visit(Faux node){
// code += "faux";
// return null;
// }
public Object visit(Idf node){
code += node.getNom();
return null;
}
// public Object visit(InfEgal node){
// node.getGauche().accept(this);
// code += " <= ";
// node.getDroite().accept(this);
// return null;
// }
//
// public Object visit(Inferieur node){
// node.getGauche().accept(this);
// code += " < ";
// node.getDroite().accept(this);
// return null;
// }
//
// public Object visit(Lire node){
// code += "lire ";
// node.getDestination().accept(this);
// code += ";";
// return null;
// }
//
// public Object visit(Moins node){
// code += "-";
// node.getOperand().accept(this);
// return null;
// }
public Object visit(Nombre node){
code += Integer.toString(node.getValeur());
return null;
}
// public Object visit(Non node){
// code += "non ";
// node.getOperand().accept(this);
// return null;
// }
//
// public Object visit(Ou node){
// node.getGauche().accept(this);
// code += " ou ";
// node.getDroite().accept(this);
// return null;
// }
//
// public Object visit(Parentheses node){
// code += "(";
// node.getExpression().accept(this);
// code += ")";
// return null;
// }
//
// public Object visit(Pour node){
// code += "pour ";
// node.getIteratorName().accept(this);
// code += " allantde ";
// node.getFrom().accept(this);
// code += " a ";
// node.getTo().accept(this);
// code+= " faire";
// level += 1;
// node.getInstruction().accept(this);
// level -= 1;
// code += "\n";
// addTabulation();
// code += "finpour";
// return null;
// }
//
// public Object visit(Produit node){
// node.getGauche().accept(this);
// code += " * ";
// node.getDroite().accept(this);
// return null;
// }
//
// public Object visit(Soustraction node){
// node.getGauche().accept(this);
// code += " - ";
// node.getDroite().accept(this);
// return null;
// }
//
// public Object visit(SupEgal node){
// node.getGauche().accept(this);
// code += " >= ";
// node.getDroite().accept(this);
// return null;
// }
//
// public Object visit(Superieur node){
// node.getGauche().accept(this);
// code += " > ";
// node.getDroite().accept(this);
// return null;
// }
//
// public Object visit(Tantque node){
// code += "tantque ";
// node.getCondition().accept(this);
// code += " faire";
// level += 1;
// node.getInstruction().accept(this);
// level -= 1;
// code += "\n";
// addTabulation();
// code += "fintantque";
// return null;
// }
//
// public Object visit(Vrai node){
// code += "vrai";
// return null;
// }
public String getCode(){
return code;
}
}
#! /bin/bash
#
# JFlex start script $Revision$
#
# if Java is not in your binary path, you need to supply its
# location in this script. The script automatically finds
# JFLEX_HOME when called directly, via binary path, or symbolic
# link.
#
# Site wide installation: simply make a symlink from e.g.
# /usr/bin/jflex to this script at its original position
#
#===================================================================
#
# configurables:
# path to the java interpreter
JAVA=java
# end configurables
#
#===================================================================
#
# calculate true location
PRG=`type $0`
PRG=${PRG##* }
# If PRG is a symlink, trace it to the real home directory
while [ -L "$PRG" ]
do
newprg=$(ls -l ${PRG})
newprg=${newprg##*-> }
[ ${newprg} = ${newprg#/} ] && newprg=${PRG%/*}/${newprg}
PRG="$newprg"
done
PRG=${PRG%/*}
JFLEX_HOME=${PRG}/..
# --------------------------------------------------------------------
$JAVA -Xmx128m -jar $JFLEX_HOME/lib/jflex-1.6.1.jar $@
import java_cup.runtime.*;
import java.util.Vector;
import java.io.*;
import java.util.*;
action code {:
:}
terminal PRG, STARTPRG, ENDPRG, CONSTANT, SEMICOLON, OPENPARENT;
terminal CLOSEPARENT, COMMA, EQUAL, DOUBLEPOINTS, OPENBRACK, CLOSEBRACK;
terminal READ, WRITE, IF, THEN, ELSE, ENDIF, WHILE, DO, ENDWHILE;
terminal FOR, FROM, TO, ENDFOR, TRUE, FALSE, PLUS, MINUS, TIMES, DIVIDE;
terminal EQUALS, DIFF, INF, INFEQUAL, SUP, SUPEQUAL, AND, OR, NOT, UMINUS;
terminal String IDENT, STRINGCONST, TINTEGER, TBOOLEAN;
terminal int INTEGERCONST;
// Non terminal rules that return a RESULT value
// TODO: N'oubliez pas de spécifier les types des non terminaux (f.e. le non terminal "op_bin" est de type Binaire)
non terminal DeclarationProgramme program, header;
non terminal Bloc declar_lst, body;
non terminal ArrayList<Instruction> instr_lst, declars, declar, declar_var;
non terminal declar_const;
non terminal Expression expr, access, operand;
non terminal for_instr;
non terminal while_instr;
non terminal cond_instr;
non terminal write_instr;
non terminal read_instr;
non terminal Instruction instr;
non terminal Affectation assign;
non terminal op_una;
non terminal Binaire op_bin;
non terminal Relation relation;
non terminal l_ident;
non terminal type;
// Precendences
precedence left AND, OR;
precedence left EQUALS, DIFF, INF, SUP, INFEQUAL, SUPEQUAL;
precedence left PLUS, MINUS;
precedence left TIMES, DIVIDE;
precedence right UMINUS, NOT;
// TODO: Completez le CUP (SANS TOUCHER AUX RÈGLES DE GRAMMAIRE) afin de construire l'arbre abstrait ainsi que la table des symboles
// HINT:
// - Nous n'avons mis les :xyz après les terminaux et non terminaux que sur les exemples de code que nous avons laissé. C'est à dire que vous devrez en rajouter vous même là ou c'est nécessaire
// - Partout ou des {: :} sont laissez vide du code devrait y être ajouté
// - Même dans les {: :} completé vous pouvez ajouter / adapter du code à l'interieur
program ::= header:program declar_lst:declarations STARTPRG body:instructions ENDPRG
{:
program.setInstructions(instructions);
RESULT = program;
:};
header ::= PRG IDENT:id {: RESULT = new DeclarationProgramme(new Idf(id, "", idleft, idright), "", idleft, idright); :};
declar_lst ::= declars {: :};
declars ::= {: :}
| declars declar {: :};
declar ::= declar_var {: :}
| declar_const {: :};
declar_var ::= type l_ident SEMICOLON {: :};
l_ident ::= IDENT {: :}
| l_ident COMMA IDENT {: :};
type ::= TINTEGER {: :}
| TBOOLEAN {: :};
declar_const ::= CONSTANT type IDENT EQUAL expr SEMICOLON {: :};
op_bin ::= expr:a PLUS expr:b {: RESULT = new Addition(a, b, "", aleft, aright); :}
| expr MINUS expr {: :}
| expr TIMES expr {: :}
| expr DIVIDE expr {: :}
| expr AND expr {: :}
| expr OR expr {: :};
relation ::= expr:a EQUALS expr:b {: RESULT = new Egal(a, b, "", aleft, aright); :}
| expr DIFF expr {: :}
| expr INF expr {: :}
| expr SUP expr {: :}
| expr INFEQUAL expr {: :}
| expr SUPEQUAL expr {: :};
op_una ::= NOT expr {: :}
| MINUS expr {: :}
%prec UMINUS;
operand ::= access:access {: RESULT = access; :}
| INTEGERCONST:ib {: RESULT = new Nombre(ib, "", ibleft, ibright); :}
| TRUE {: :}
| FALSE {: :};
access ::= IDENT:id {: RESULT = new Idf(id, "", idleft, idright); :};
expr ::= op_bin:exp {: RESULT = exp; :}
| relation:exp {: RESULT = exp; :}
| op_una {: :}
| operand:operand {: RESULT = operand; :}
| OPENPARENT expr CLOSEPARENT {: :};
body ::= instr_lst:instructions {: RESULT = new Bloc(instructions, "", instructionsleft, instructionsright); :};
instr_lst ::= {: RESULT = new ArrayList(); :}
| instr_lst:instructionList instr:instruction
{:
ArrayList<Instruction> instructions = new ArrayList<Instruction>(instructionList);
instructions.add(instruction);
RESULT = instructions;
:};
instr ::= assign:inst {: RESULT = inst; :}
| write_instr {: :}
| read_instr {: :}
| cond_instr {: :}
| while_instr {: :}
| for_instr {: :};
assign ::= access:dest EQUAL:e expr:src SEMICOLON {: RESULT = new Affectation(dest, src, "", eleft, eright); :};
write_instr ::= WRITE expr SEMICOLON {: :}
| WRITE STRINGCONST SEMICOLON {: :};
read_instr ::= READ IDENT SEMICOLON {: :};
cond_instr ::= IF expr THEN body ELSE body ENDIF {: :}
| IF expr THEN body ENDIF {: :};
while_instr ::= WHILE expr DO body ENDWHILE {: :};
for_instr ::= FOR IDENT FROM expr TO expr DO body ENDFOR {: :};
import java_cup.runtime.*;
import java.util.*;
%%
%class HepialLexer
%line
%column
%cup
//%debug
%{
// Print parsing errors
public void yyerror() {
System.out.println("error line " +yyline + " column " +yycolumn
+ " " +yytext());
}
%}
/* models */
ident = [a-zA-Z][A-Za-z0-9]*
constantInt = [0-9]+
constanteStr = \"([^\"]|\"\")*\" // double " to add in string
comma = ,
semicolon = ;
equal = "="
openparent = "("
closeparent = ")"
openbrack = "["
closebrack = "]"
doublepoints = ".."
// ignored
comment = \/\/.*
blank = [\s|\t|\n|\r]+
%%
/* rules */
programme { return new Symbol(sym.PRG, yyline, yycolumn); }
debutprg { return new Symbol(sym.STARTPRG, yyline, yycolumn); }
finprg { return new Symbol(sym.ENDPRG, yyline, yycolumn); }
constante { return new Symbol(sym.CONSTANT, yyline, yycolumn); }
{semicolon} { return new Symbol(sym.SEMICOLON, yyline, yycolumn); }
{openparent} { return new Symbol(sym.OPENPARENT, yyline, yycolumn); }
{closeparent} { return new Symbol(sym.CLOSEPARENT, yyline, yycolumn); }
{comma} { return new Symbol(sym.COMMA, yyline, yycolumn); }
{equal} { return new Symbol(sym.EQUAL, yyline, yycolumn); }
{doublepoints} { return new Symbol(sym.DOUBLEPOINTS, yyline, yycolumn); }
{openbrack} { return new Symbol(sym.OPENBRACK, yyline, yycolumn); }
{closebrack} { return new Symbol(sym.CLOSEBRACK, yyline, yycolumn); }
{constantInt} { return new Symbol(sym.INTEGERCONST, yyline, yycolumn, Integer.parseInt(yytext())); }
{constanteStr} { return new Symbol(sym.STRINGCONST, yyline, yycolumn, yytext()); }
entier { return new Symbol(sym.TINTEGER, yyline, yycolumn); }
booleen { return new Symbol(sym.TBOOLEAN, yyline, yycolumn); }
lire { return new Symbol(sym.READ, yyline, yycolumn); }
ecrire { return new Symbol(sym.WRITE, yyline, yycolumn); }
si { return new Symbol(sym.IF, yyline, yycolumn); }
alors { return new Symbol(sym.THEN, yyline, yycolumn); }
sinon { return new Symbol(sym.ELSE, yyline, yycolumn); }
finsi { return new Symbol(sym.ENDIF, yyline, yycolumn); }
tantque { return new Symbol(sym.WHILE, yyline, yycolumn); }
faire { return new Symbol(sym.DO, yyline, yycolumn); }
fintantque { return new Symbol(sym.ENDWHILE, yyline, yycolumn); }
pour { return new Symbol(sym.FOR, yyline, yycolumn); }
allantde { return new Symbol(sym.FROM, yyline, yycolumn); }
a { return new Symbol(sym.TO, yyline, yycolumn); }
finpour { return new Symbol(sym.ENDFOR, yyline, yycolumn); }
vrai { return new Symbol(sym.TRUE, yyline, yycolumn); }
faux { return new Symbol(sym.FALSE, yyline, yycolumn); }
\+ { return new Symbol(sym.PLUS, yyline, yycolumn); }
- { return new Symbol(sym.MINUS, yyline, yycolumn); }
\* { return new Symbol(sym.TIMES, yyline, yycolumn); }
\/ { return new Symbol(sym.DIVIDE, yyline, yycolumn); }
== { return new Symbol(sym.EQUALS, yyline, yycolumn); }
"<>" { return new Symbol(sym.DIFF, yyline, yycolumn); }
"<" { return new Symbol(sym.INF, yyline, yycolumn); }
"<=" { return new Symbol(sym.INFEQUAL, yyline, yycolumn); }
> { return new Symbol(sym.SUP, yyline, yycolumn); }
>= { return new Symbol(sym.SUPEQUAL, yyline, yycolumn); }
et { return new Symbol(sym.AND, yyline, yycolumn); }
ou { return new Symbol(sym.OR, yyline, yycolumn); }
non { return new Symbol(sym.NOT, yyline, yycolumn); }
{ident} { return new Symbol(sym.IDENT, yyline, yycolumn, yytext()); }
// ignored tags
{comment} {;}
{blank} {;}
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment