Analyse grammaticale ok*

This commit is contained in:
Tali Elies 2021-03-18 12:21:27 +01:00
parent 62ec7ad082
commit 524b766ac4
10 changed files with 515 additions and 225 deletions

Binary file not shown.

View file

@ -1,38 +1,44 @@
%{ %{
#include "as.tab.h" #include "as.tab.h"
#include <stdio.h> int yywrap(void){return 1;}
%} %}
%% %%
"main" { printf("tMAIN\n");} "main" { return tMAIN ;}
"{" { printf("tOBRACKET\n"); } "{" { return tOBRACKET;}
"}" { printf("tCBRACKET\n"); } "}" { return tCBRACKET; }
"(" { printf("tOBRACE\n"); } "(" { return tOBRACE; }
")" { printf("tCBRACE\n"); } ")" { return tCBRACE; }
"const" { printf("tCONST\n"); } "const" { return tCONST; }
"int" { printf("tINT\n"); } "int" { return tINT; }
"printf" { printf("tPRINTF\n"); } //Degeu mais à degager "printf" { return tPRINTF; } //Degeu mais à degager
"if" { return tIF; }
"while" { return tWHILE; }
"<" { return tLT; }
">" { return tGT; }
"==" { return tEQCOND; }
"&&" { return tAND; }
"||" { return tOR; }
"else" { return tELSE;}
[0-9]+ { yylval.nombre = atoi(yytext); return tNB; }
[0-9]+e[0-9]+ { yylval.nombre = -1; return tNBEXP; } //Renvoyer le token tNB et pas tNBEXP
[0-9]+ { printf("tNB\n"); } "+" { return tADD; }
[0-9]+e[0-9]+ { printf("tNBEXP\n"); } //Renvoyer le token tNB et pas tNBEXP "-" { return tSUB; }
"+" { printf("tADD\n"); } "*" { return tMUL; }
"-" { printf("tSUB\n"); } "/" { return tDIV; }
"*" { printf("tMUL\n"); } "=" { return tEQ; }
"/" { printf("tDIV\n"); } ";" { return tPV; }
"=" { printf("tEQ\n"); } " " {} //Ne pas les retourner à Yacc
";" { printf("tPV\n"); } " " {} //Ne pas les retourner à Yacc
" " { printf("tSPACE\n"); } //Ne pas les retourner à Yacc "," { return tCOMA; }
" " { printf("tTAB\n"); } //Ne pas les retourner à Yacc "/*"[^(*/)]*"*/" { printf("commentaire\n");}
"," { printf("tCOMA\n"); } "\n" {} //Ne pas les retourner à Yacc
"\n" { printf("tRC\n") ; } //Ne pas les retourner à Yacc [a-zA-Z][a-zA-Z0-9_]* { strcpy(yylval.id, yytext); return tID; }
[a-zA-Z][a-zA-Z0-9_]* { printf("tID\n"); }
. { return tERROR; } . { return tERROR; }
%% %%
int yywrap(void){return 1;}

View file

@ -98,14 +98,33 @@ extern int yydebug;
# define YYTOKENTYPE # define YYTOKENTYPE
enum yytokentype enum yytokentype
{ {
tNB = 258, tMAIN = 258,
tADD = 259, tOBRACKET = 259,
tSUB = 260, tCBRACKET = 260,
tOB = 261, tOBRACE = 261,
tCB = 262, tCBRACE = 262,
tPV = 263, tINT = 263,
tERROR = 264, tCONST = 264,
tMAIN = 265 tPV = 265,
tCOMA = 266,
tMUL = 267,
tDIV = 268,
tADD = 269,
tSUB = 270,
tEQ = 271,
tNB = 272,
tNBEXP = 273,
tID = 274,
tPRINTF = 275,
tERROR = 276,
tIF = 277,
tWHILE = 278,
tELSE = 279,
tLT = 280,
tGT = 281,
tEQCOND = 282,
tAND = 283,
tOR = 284
}; };
#endif #endif
@ -117,8 +136,9 @@ union YYSTYPE
#line 1 "as.y" /* yacc.c:355 */ #line 1 "as.y" /* yacc.c:355 */
int nombre; int nombre;
char id[30];
#line 122 "as.tab.c" /* yacc.c:355 */ #line 142 "as.tab.c" /* yacc.c:355 */
}; };
typedef union YYSTYPE YYSTYPE; typedef union YYSTYPE YYSTYPE;
@ -134,8 +154,11 @@ int yyparse (void);
#endif /* !YY_YY_AS_TAB_H_INCLUDED */ #endif /* !YY_YY_AS_TAB_H_INCLUDED */
/* Copy the second part of user declarations. */ /* Copy the second part of user declarations. */
#line 5 "as.y" /* yacc.c:358 */
#line 139 "as.tab.c" /* yacc.c:358 */ #include <stdio.h>
#line 162 "as.tab.c" /* yacc.c:358 */
#ifdef short #ifdef short
# undef short # undef short
@ -375,23 +398,23 @@ union yyalloc
#endif /* !YYCOPY_NEEDED */ #endif /* !YYCOPY_NEEDED */
/* YYFINAL -- State number of the termination state. */ /* YYFINAL -- State number of the termination state. */
#define YYFINAL 6 #define YYFINAL 4
/* YYLAST -- Last index in YYTABLE. */ /* YYLAST -- Last index in YYTABLE. */
#define YYLAST 15 #define YYLAST 117
/* YYNTOKENS -- Number of terminals. */ /* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 11 #define YYNTOKENS 30
/* YYNNTS -- Number of nonterminals. */ /* YYNNTS -- Number of nonterminals. */
#define YYNNTS 4 #define YYNNTS 19
/* YYNRULES -- Number of rules. */ /* YYNRULES -- Number of rules. */
#define YYNRULES 8 #define YYNRULES 45
/* YYNSTATES -- Number of states. */ /* YYNSTATES -- Number of states. */
#define YYNSTATES 15 #define YYNSTATES 98
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
by yylex, with out-of-bounds checking. */ by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2 #define YYUNDEFTOK 2
#define YYMAXUTOK 265 #define YYMAXUTOK 284
#define YYTRANSLATE(YYX) \ #define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@ -426,14 +449,20 @@ static const yytype_uint8 yytranslate[] =
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29
}; };
#if YYDEBUG #if YYDEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] = static const yytype_uint8 yyrline[] =
{ {
0, 30, 30, 29, 32, 35, 36, 37, 38 0, 28, 28, 30, 31, 32, 33, 34, 36, 39,
40, 41, 42, 43, 44, 45, 48, 49, 50, 51,
52, 54, 55, 56, 57, 60, 62, 63, 64, 65,
66, 67, 68, 69, 70, 71, 72, 73, 74, 77,
78, 79, 80, 81, 82, 84
}; };
#endif #endif
@ -442,8 +471,14 @@ static const yytype_uint8 yyrline[] =
First, the terminals, then, starting at YYNTOKENS, nonterminals. */ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] = static const char *const yytname[] =
{ {
"$end", "error", "$undefined", "tNB", "tADD", "tSUB", "tOB", "tCB", "$end", "error", "$undefined", "tMAIN", "tOBRACKET", "tCBRACKET",
"tPV", "tERROR", "tMAIN", "$accept", "S", "$@1", "E", YY_NULLPTR "tOBRACE", "tCBRACE", "tINT", "tCONST", "tPV", "tCOMA", "tMUL", "tDIV",
"tADD", "tSUB", "tEQ", "tNB", "tNBEXP", "tID", "tPRINTF", "tERROR",
"tIF", "tWHILE", "tELSE", "tLT", "tGT", "tEQCOND", "tAND", "tOR",
"$accept", "Main", "Params", "Param", "SuiteParams", "Body",
"Instructions", "Instruction", "If", "Else", "While", "Cond",
"SuiteCond", "Aff", "E", "Decl", "SuiteDecl", "FinDeclaration",
"Invocation", YY_NULLPTR
}; };
#endif #endif
@ -453,14 +488,15 @@ static const char *const yytname[] =
static const yytype_uint16 yytoknum[] = static const yytype_uint16 yytoknum[] =
{ {
0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284
}; };
# endif # endif
#define YYPACT_NINF -4 #define YYPACT_NINF -68
#define yypact_value_is_default(Yystate) \ #define yypact_value_is_default(Yystate) \
(!!((Yystate) == (-4))) (!!((Yystate) == (-68)))
#define YYTABLE_NINF -1 #define YYTABLE_NINF -1
@ -471,8 +507,16 @@ static const yytype_uint16 yytoknum[] =
STATE-NUM. */ STATE-NUM. */
static const yytype_int8 yypact[] = static const yytype_int8 yypact[] =
{ {
7, -4, 7, 1, -1, 4, -4, 7, 7, -4, 9, 2, 22, 30, -68, 20, 18, 39, 40, -68,
-4, -3, -4, 7, -4 48, 20, -68, 73, -68, 40, 45, 50, 43, 64,
69, 70, 72, 73, -68, -68, -68, -68, 81, -68,
86, 79, 88, 80, 88, 88, -68, -68, -68, 85,
-7, 86, 88, 88, -68, -68, -68, 35, -68, 76,
102, 28, 103, 86, -68, 88, -68, 95, 0, 75,
-68, 88, 88, 88, 88, 88, 88, 88, -68, 48,
88, 88, -68, 48, -68, 53, 88, -68, 75, 75,
75, 75, 75, 75, 75, 89, 28, 28, -68, -68,
59, -3, -68, -68, -68, -68, -68, -68
}; };
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
@ -480,20 +524,30 @@ static const yytype_int8 yypact[] =
means the default is an error. */ means the default is an error. */
static const yytype_uint8 yydefact[] = static const yytype_uint8 yydefact[] =
{ {
4, 8, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 1, 3, 0, 0, 7, 5,
7, 5, 6, 4, 3 0, 0, 4, 10, 2, 7, 0, 0, 0, 0,
0, 0, 0, 10, 14, 15, 11, 12, 0, 6,
42, 0, 0, 0, 0, 0, 8, 9, 13, 0,
0, 42, 0, 0, 26, 27, 28, 0, 33, 0,
0, 22, 0, 42, 44, 0, 39, 0, 0, 35,
25, 0, 0, 0, 0, 0, 0, 0, 45, 0,
0, 0, 21, 0, 41, 0, 0, 34, 30, 32,
29, 31, 38, 37, 36, 19, 22, 22, 20, 43,
0, 0, 16, 23, 24, 40, 18, 17
}; };
/* YYPGOTO[NTERM-NUM]. */ /* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] = static const yytype_int8 yypgoto[] =
{ {
-4, 2, -4, -2 -68, -68, -68, 101, 99, -67, 92, -68, 25, -68,
-68, 82, -66, -68, -32, -68, -37, -68, -5
}; };
/* YYDEFGOTO[NTERM-NUM]. */ /* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] = static const yytype_int8 yydefgoto[] =
{ {
-1, 3, 13, 4 -1, 2, 7, 8, 12, 14, 22, 23, 24, 92,
25, 50, 72, 26, 51, 27, 40, 56, 48
}; };
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
@ -501,34 +555,70 @@ static const yytype_int8 yydefgoto[] =
number is the opposite. If YYTABLE_NINF, syntax error. */ number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_uint8 yytable[] = static const yytype_uint8 yytable[] =
{ {
5, 6, 8, 7, 8, 11, 12, 9, 7, 8, 47, 13, 85, 54, 57, 3, 88, 77, 28, 55,
1, 10, 0, 2, 0, 14 58, 59, 61, 62, 63, 64, 74, 1, 28, 20,
93, 94, 4, 75, 96, 65, 66, 67, 6, 78,
79, 80, 81, 82, 83, 84, 5, 9, 86, 87,
61, 62, 63, 64, 90, 60, 10, 61, 62, 63,
64, 11, 13, 65, 66, 67, 70, 71, 31, 32,
65, 66, 67, 89, 30, 61, 62, 63, 64, 95,
33, 61, 62, 63, 64, 34, 35, 36, 65, 66,
67, 16, 17, 68, 65, 66, 67, 61, 62, 63,
64, 38, 18, 19, 42, 20, 21, 39, 41, 49,
65, 66, 67, 43, 53, 44, 45, 46, 19, 69,
73, 76, 15, 91, 29, 37, 97, 52
}; };
static const yytype_int8 yycheck[] = static const yytype_uint8 yycheck[] =
{ {
2, 0, 5, 4, 5, 7, 8, 8, 4, 5, 32, 4, 69, 10, 41, 3, 73, 7, 13, 16,
3, 7, -1, 6, -1, 13 42, 43, 12, 13, 14, 15, 53, 8, 23, 22,
86, 87, 0, 55, 91, 25, 26, 27, 8, 61,
62, 63, 64, 65, 66, 67, 6, 19, 70, 71,
12, 13, 14, 15, 76, 10, 7, 12, 13, 14,
15, 11, 4, 25, 26, 27, 28, 29, 8, 16,
25, 26, 27, 10, 19, 12, 13, 14, 15, 10,
6, 12, 13, 14, 15, 6, 6, 5, 25, 26,
27, 8, 9, 7, 25, 26, 27, 12, 13, 14,
15, 10, 19, 20, 6, 22, 23, 11, 19, 19,
25, 26, 27, 15, 19, 17, 18, 19, 20, 7,
7, 16, 11, 24, 15, 23, 91, 35
}; };
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */ symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] = static const yytype_uint8 yystos[] =
{ {
0, 3, 6, 12, 14, 14, 0, 4, 5, 8, 0, 8, 31, 3, 0, 6, 8, 32, 33, 19,
7, 14, 14, 13, 12 7, 11, 34, 4, 35, 33, 8, 9, 19, 20,
22, 23, 36, 37, 38, 40, 43, 45, 48, 34,
19, 8, 16, 6, 6, 6, 5, 36, 10, 11,
46, 19, 6, 15, 17, 18, 19, 44, 48, 19,
41, 44, 41, 19, 10, 16, 47, 46, 44, 44,
10, 12, 13, 14, 15, 25, 26, 27, 7, 7,
28, 29, 42, 7, 46, 44, 16, 7, 44, 44,
44, 44, 44, 44, 44, 35, 44, 44, 35, 10,
44, 24, 39, 42, 42, 10, 35, 38
}; };
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] = static const yytype_uint8 yyr1[] =
{ {
0, 11, 13, 12, 12, 14, 14, 14, 14 0, 30, 31, 32, 32, 33, 34, 34, 35, 36,
36, 37, 37, 37, 37, 37, 38, 39, 39, 39,
40, 41, 42, 42, 42, 43, 44, 44, 44, 44,
44, 44, 44, 44, 44, 44, 44, 44, 44, 45,
45, 46, 46, 47, 47, 48
}; };
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
static const yytype_uint8 yyr2[] = static const yytype_uint8 yyr2[] =
{ {
0, 2, 0, 4, 0, 3, 3, 3, 1 0, 2, 6, 0, 2, 2, 3, 0, 3, 2,
0, 1, 1, 2, 1, 1, 6, 2, 2, 0,
5, 2, 0, 3, 3, 4, 1, 1, 1, 3,
3, 3, 3, 1, 3, 2, 3, 3, 3, 4,
7, 3, 0, 3, 1, 4
}; };
@ -1205,43 +1295,97 @@ yyreduce:
switch (yyn) switch (yyn)
{ {
case 2: case 2:
#line 30 "as.y" /* yacc.c:1646 */ #line 28 "as.y" /* yacc.c:1646 */
{ printf("RES: %d\n", (yyvsp[-1].nombre)); } { printf("Main reconnu\n"); }
#line 1211 "as.tab.c" /* yacc.c:1646 */ #line 1301 "as.tab.c" /* yacc.c:1646 */
break; break;
case 4: case 3:
#line 32 "as.y" /* yacc.c:1646 */ #line 30 "as.y" /* yacc.c:1646 */
{ printf("END\n"); } { printf("Sans Params\n"); }
#line 1217 "as.tab.c" /* yacc.c:1646 */ #line 1307 "as.tab.c" /* yacc.c:1646 */
break; break;
case 5: case 5:
#line 35 "as.y" /* yacc.c:1646 */ #line 32 "as.y" /* yacc.c:1646 */
{ (yyval.nombre) = (yyvsp[-2].nombre) + (yyvsp[0].nombre); } { printf("Prametre : %s\n", (yyvsp[0].id)); }
#line 1223 "as.tab.c" /* yacc.c:1646 */ #line 1313 "as.tab.c" /* yacc.c:1646 */
break;
case 6:
#line 36 "as.y" /* yacc.c:1646 */
{ (yyval.nombre) = (yyvsp[-2].nombre) - (yyvsp[0].nombre); }
#line 1229 "as.tab.c" /* yacc.c:1646 */
break;
case 7:
#line 37 "as.y" /* yacc.c:1646 */
{ (yyval.nombre) = (yyvsp[-1].nombre); }
#line 1235 "as.tab.c" /* yacc.c:1646 */
break; break;
case 8: case 8:
#line 38 "as.y" /* yacc.c:1646 */ #line 36 "as.y" /* yacc.c:1646 */
{ (yyval.nombre) = (yyvsp[0].nombre); } { printf("Body reconnu\n"); }
#line 1241 "as.tab.c" /* yacc.c:1646 */ #line 1319 "as.tab.c" /* yacc.c:1646 */
break;
case 16:
#line 48 "as.y" /* yacc.c:1646 */
{ printf("If reconnu\n"); }
#line 1325 "as.tab.c" /* yacc.c:1646 */
break;
case 17:
#line 49 "as.y" /* yacc.c:1646 */
{ printf("Else if reconnu\n"); }
#line 1331 "as.tab.c" /* yacc.c:1646 */
break;
case 18:
#line 50 "as.y" /* yacc.c:1646 */
{ printf("Else reconnu\n"); }
#line 1337 "as.tab.c" /* yacc.c:1646 */
break;
case 20:
#line 52 "as.y" /* yacc.c:1646 */
{ printf("While reconnu\n"); }
#line 1343 "as.tab.c" /* yacc.c:1646 */
break;
case 25:
#line 60 "as.y" /* yacc.c:1646 */
{ printf("%s prend une valeur\n", (yyvsp[-3].id)); }
#line 1349 "as.tab.c" /* yacc.c:1646 */
break;
case 39:
#line 77 "as.y" /* yacc.c:1646 */
{ printf("Declaration de %s\n", (yyvsp[-2].id)); }
#line 1355 "as.tab.c" /* yacc.c:1646 */
break;
case 40:
#line 78 "as.y" /* yacc.c:1646 */
{ printf("Declaration de %s (CONSTANTE)\n", (yyvsp[-4].id)); }
#line 1361 "as.tab.c" /* yacc.c:1646 */
break;
case 41:
#line 79 "as.y" /* yacc.c:1646 */
{ printf("Declaration de %s\n", (yyvsp[-1].id)); }
#line 1367 "as.tab.c" /* yacc.c:1646 */
break;
case 43:
#line 81 "as.y" /* yacc.c:1646 */
{ printf("Declaration avec valeur\n"); }
#line 1373 "as.tab.c" /* yacc.c:1646 */
break;
case 44:
#line 82 "as.y" /* yacc.c:1646 */
{ printf("Declaration sans valeur\n"); }
#line 1379 "as.tab.c" /* yacc.c:1646 */
break;
case 45:
#line 84 "as.y" /* yacc.c:1646 */
{ printf("Appel de printf sur %s\n", (yyvsp[-1].id)); }
#line 1385 "as.tab.c" /* yacc.c:1646 */
break; break;
#line 1245 "as.tab.c" /* yacc.c:1646 */ #line 1389 "as.tab.c" /* yacc.c:1646 */
default: break; default: break;
} }
/* User semantic actions sometimes alter yychar, and that requires /* User semantic actions sometimes alter yychar, and that requires
@ -1469,11 +1613,9 @@ yyreturn:
#endif #endif
return yyresult; return yyresult;
} }
#line 41 "as.y" /* yacc.c:1906 */ #line 98 "as.y" /* yacc.c:1906 */
int yywrap(void){return 1;}
#include <stdio.h>
void main(void) { void main(void) {
yyparse(); yyparse();
} }

View file

@ -45,14 +45,33 @@ extern int yydebug;
# define YYTOKENTYPE # define YYTOKENTYPE
enum yytokentype enum yytokentype
{ {
tNB = 258, tMAIN = 258,
tADD = 259, tOBRACKET = 259,
tSUB = 260, tCBRACKET = 260,
tOB = 261, tOBRACE = 261,
tCB = 262, tCBRACE = 262,
tPV = 263, tINT = 263,
tERROR = 264, tCONST = 264,
tMAIN = 265 tPV = 265,
tCOMA = 266,
tMUL = 267,
tDIV = 268,
tADD = 269,
tSUB = 270,
tEQ = 271,
tNB = 272,
tNBEXP = 273,
tID = 274,
tPRINTF = 275,
tERROR = 276,
tIF = 277,
tWHILE = 278,
tELSE = 279,
tLT = 280,
tGT = 281,
tEQCOND = 282,
tAND = 283,
tOR = 284
}; };
#endif #endif
@ -64,8 +83,9 @@ union YYSTYPE
#line 1 "as.y" /* yacc.c:1909 */ #line 1 "as.y" /* yacc.c:1909 */
int nombre; int nombre;
char id[30];
#line 69 "as.tab.h" /* yacc.c:1909 */ #line 89 "as.tab.h" /* yacc.c:1909 */
}; };
typedef union YYSTYPE YYSTYPE; typedef union YYSTYPE YYSTYPE;

View file

@ -1,6 +1,10 @@
%union { %union {
int nombre; int nombre;
char id[30];
} }
%{
#include <stdio.h>
%}
%token tMAIN %token tMAIN
%token tOBRACKET tCBRACKET %token tOBRACKET tCBRACKET
@ -10,22 +14,76 @@
%token tPV tCOMA %token tPV tCOMA
%token tMUL tDIV tADD tSUB tEQ %token tMUL tDIV tADD tSUB tEQ
%token<nombre> tNB tNBEXP %token<nombre> tNB tNBEXP
%token<id> tID
%token tPRINTF %token tPRINTF
%token tERROR %token tERROR
%token tIF tWHILE tELSE
%token tLT tGT tEQCOND
%token tAND tOR
//%type<nombre> E //%type<nombre> E
/* 1 + 2 + 3 + 4 */
/* E => E + E => 1 + E => 1 + E + E ... */
/* E => E + E => E + 4 => E + E + 4 ... */
%% %%
/* S -> E ; S Main : tINT tMAIN tOBRACE Params tCBRACE Body { printf("Main reconnu\n"); } ;
* S ->
*/ Params : { printf("Sans Params\n"); } ;
S : E tPV Params : Param SuiteParams ;
Param : tINT tID { printf("Prametre : %s\n", $2); };
SuiteParams : tCOMA Param SuiteParams ;
SuiteParams : ;
Body : tOBRACKET Instructions tCBRACKET { printf("Body reconnu\n"); } ;
Instructions : Instruction Instructions ;
Instructions : ;
Instruction : Aff ;
Instruction : Decl ;
Instruction : Invocation tPV ;
Instruction : If;
Instruction : While;
If : tIF tOBRACE Cond tCBRACE Body Else { printf("If reconnu\n"); };
Else : tELSE If { printf("Else if reconnu\n"); };
Else : tELSE Body { printf("Else reconnu\n"); };
Else : ;
While : tWHILE tOBRACE Cond tCBRACE Body { printf("While reconnu\n"); };
Cond : E SuiteCond ;
SuiteCond : ;
SuiteCond : tAND E SuiteCond;
SuiteCond : tOR E SuiteCond;
Aff : tID tEQ E tPV { printf("%s prend une valeur\n", $1); } ;
E : tNB ;
E : tNBEXP ;
E : tID ;
E : E tADD E ;
E : E tMUL E ;
E : E tSUB E ;
E : E tDIV E ;
E : Invocation ;
E : tOBRACE E tCBRACE ;
E : tSUB E ;
E : E tEQCOND E;
E : E tGT E;
E : E tLT E;
Decl : tINT tID SuiteDecl FinDeclaration { printf("Declaration de %s\n", $2); } ;
Decl : tCONST tINT tID SuiteDecl tEQ E tPV { printf("Declaration de %s (CONSTANTE)\n", $3); } ;
SuiteDecl : tCOMA tID SuiteDecl { printf("Declaration de %s\n", $2); } ;
SuiteDecl : ;
FinDeclaration : tEQ E tPV { printf("Declaration avec valeur\n"); };
FinDeclaration : tPV { printf("Declaration sans valeur\n"); };
Invocation : tPRINTF tOBRACE tID tCBRACE { printf("Appel de printf sur %s\n", $3); } ;
/*S : E tPV
{ printf("RES: %d\n", $1); } { printf("RES: %d\n", $1); }
S S
| { printf("END\n"); } | { printf("END\n"); }
@ -35,10 +93,10 @@ E : E tADD E { $$ = $1 + $3; }
| E tSUB E { $$ = $1 - $3; } | E tSUB E { $$ = $1 - $3; }
| tOB E tCB { $$ = $2; } | tOB E tCB { $$ = $2; }
| tNB { $$ = $1; } | tNB { $$ = $1; }
; ;*/
%% %%
#include <stdio.h>
void main(void) { void main(void) {
yyparse(); yyparse();
} }

View file

@ -351,8 +351,8 @@ static void yynoreturn yy_fatal_error ( const char* msg );
(yy_hold_char) = *yy_cp; \ (yy_hold_char) = *yy_cp; \
*yy_cp = '\0'; \ *yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp; (yy_c_buf_p) = yy_cp;
#define YY_NUM_RULES 23 #define YY_NUM_RULES 32
#define YY_END_OF_BUFFER 24 #define YY_END_OF_BUFFER 33
/* This struct is not used in this scanner, /* This struct is not used in this scanner,
but its presence is necessary. */ but its presence is necessary. */
struct yy_trans_info struct yy_trans_info
@ -360,13 +360,15 @@ struct yy_trans_info
flex_int32_t yy_verify; flex_int32_t yy_verify;
flex_int32_t yy_nxt; flex_int32_t yy_nxt;
}; };
static const flex_int16_t yy_accept[45] = static const flex_int16_t yy_accept[66] =
{ 0, { 0,
0, 0, 24, 22, 20, 17, 4, 5, 13, 11, 0, 0, 33, 31, 29, 25, 31, 4, 5, 21,
19, 12, 14, 9, 16, 15, 21, 21, 21, 21, 19, 27, 20, 22, 17, 24, 11, 23, 12, 30,
21, 2, 3, 0, 9, 0, 21, 21, 21, 21, 30, 30, 30, 30, 30, 30, 2, 31, 3, 0,
21, 18, 10, 21, 7, 21, 21, 21, 1, 21, 14, 0, 17, 0, 13, 30, 30, 30, 9, 30,
6, 21, 8, 0 30, 30, 30, 15, 26, 0, 0, 18, 30, 30,
7, 30, 30, 30, 28, 30, 16, 1, 30, 30,
6, 30, 10, 8, 0
} ; } ;
static const YY_CHAR yy_ec[256] = static const YY_CHAR yy_ec[256] =
@ -374,17 +376,17 @@ static const YY_CHAR yy_ec[256] =
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 3, 1, 1, 1, 1, 1, 1, 1, 4, 1, 3, 1, 4, 1, 1, 1, 5, 1, 6,
5, 6, 7, 8, 9, 1, 10, 11, 11, 11, 7, 8, 9, 10, 11, 1, 12, 13, 13, 13,
11, 11, 11, 11, 11, 11, 11, 1, 12, 1, 13, 13, 13, 13, 13, 13, 13, 1, 14, 15,
13, 1, 1, 1, 14, 14, 14, 14, 14, 14, 16, 17, 1, 1, 18, 18, 18, 18, 18, 18,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
1, 1, 1, 1, 15, 1, 16, 14, 17, 14, 1, 1, 1, 1, 19, 1, 20, 18, 21, 18,
18, 19, 14, 14, 20, 14, 14, 14, 21, 22, 22, 23, 18, 24, 25, 18, 18, 26, 27, 28,
23, 24, 14, 25, 26, 27, 14, 14, 14, 14, 29, 30, 18, 31, 32, 33, 18, 18, 34, 18,
14, 14, 28, 1, 29, 1, 1, 1, 1, 1, 18, 18, 35, 36, 37, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@ -401,55 +403,68 @@ static const YY_CHAR yy_ec[256] =
1, 1, 1, 1, 1 1, 1, 1, 1, 1
} ; } ;
static const YY_CHAR yy_meta[30] = static const YY_CHAR yy_meta[38] =
{ 0, { 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1,
2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 1, 1, 1, 1, 3, 3, 3,
2, 2, 2, 2, 2, 2, 2, 1, 1 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 1, 1, 1
} ; } ;
static const flex_int16_t yy_base[46] = static const flex_int16_t yy_base[68] =
{ 0, { 0,
0, 0, 53, 54, 54, 49, 54, 54, 54, 54, 0, 0, 78, 79, 79, 74, 71, 79, 79, 79,
54, 54, 54, 19, 54, 54, 0, 28, 28, 33, 79, 79, 79, 67, 25, 79, 79, 58, 79, 0,
23, 54, 54, 44, 20, 35, 0, 23, 17, 23, 44, 46, 16, 51, 39, 45, 79, 32, 79, 64,
22, 54, 30, 14, 0, 17, 14, 8, 0, 7, 79, 58, 27, 52, 79, 0, 36, 31, 0, 29,
0, 14, 0, 54, 30 36, 35, 34, 79, 79, 50, 45, 43, 23, 32,
0, 25, 23, 22, 79, 13, 0, 0, 12, 21,
0, 19, 0, 0, 79, 38, 49
} ; } ;
static const flex_int16_t yy_def[46] = static const flex_int16_t yy_def[68] =
{ 0, { 0,
44, 1, 44, 44, 44, 44, 44, 44, 44, 44, 65, 1, 65, 65, 65, 65, 65, 65, 65, 65,
44, 44, 44, 44, 44, 44, 45, 45, 45, 45, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66,
45, 44, 44, 44, 44, 44, 45, 45, 45, 45, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65,
45, 44, 44, 45, 45, 45, 45, 45, 45, 45, 65, 67, 65, 65, 65, 66, 66, 66, 66, 66,
45, 45, 45, 0, 44 66, 66, 66, 65, 65, 67, 65, 65, 66, 66,
66, 66, 66, 66, 65, 66, 66, 66, 66, 66,
66, 66, 66, 66, 0, 65, 65
} ; } ;
static const flex_int16_t yy_nxt[84] = static const flex_int16_t yy_nxt[117] =
{ 0, { 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 4, 5, 6, 4, 7, 8, 9, 10, 11, 12,
14, 15, 16, 17, 4, 17, 18, 17, 17, 19, 13, 14, 15, 16, 17, 18, 19, 20, 4, 20,
20, 17, 17, 21, 17, 17, 17, 22, 23, 25, 21, 22, 20, 20, 23, 20, 24, 20, 20, 25,
25, 27, 43, 42, 41, 40, 26, 26, 39, 38, 20, 20, 20, 26, 27, 28, 29, 33, 39, 33,
33, 37, 36, 35, 34, 33, 32, 31, 30, 29, 36, 64, 63, 40, 62, 61, 34, 60, 34, 46,
28, 24, 44, 3, 44, 44, 44, 44, 44, 44, 59, 46, 58, 57, 56, 48, 55, 47, 54, 53,
44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 52, 51, 50, 49, 48, 47, 45, 44, 43, 42,
44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 41, 38, 37, 35, 32, 31, 30, 65, 3, 65,
44, 44, 44 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65
} ; } ;
static const flex_int16_t yy_chk[84] = static const flex_int16_t yy_chk[117] =
{ 0, { 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 14, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
25, 45, 42, 40, 38, 37, 14, 25, 36, 34, 1, 1, 1, 1, 1, 1, 1, 15, 23, 33,
33, 31, 30, 29, 28, 26, 24, 21, 20, 19, 66, 62, 60, 23, 59, 56, 15, 54, 33, 67,
18, 6, 3, 44, 44, 44, 44, 44, 44, 44, 53, 67, 52, 50, 49, 48, 47, 46, 43, 42,
44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 41, 40, 38, 37, 34, 32, 30, 28, 26, 25,
44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 24, 22, 21, 18, 14, 7, 6, 3, 65, 65,
44, 44, 44 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65
} ; } ;
static yy_state_type yy_last_accepting_state; static yy_state_type yy_last_accepting_state;
@ -469,9 +484,9 @@ char *yytext;
#line 1 "al.lex" #line 1 "al.lex"
#line 2 "al.lex" #line 2 "al.lex"
#include "as.tab.h" #include "as.tab.h"
#include <stdio.h> int yywrap(void){return 1;}
#line 474 "lex.yy.c" #line 489 "lex.yy.c"
#line 475 "lex.yy.c" #line 490 "lex.yy.c"
#define INITIAL 0 #define INITIAL 0
@ -691,7 +706,7 @@ YY_DECL
#line 6 "al.lex" #line 6 "al.lex"
#line 695 "lex.yy.c" #line 710 "lex.yy.c"
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{ {
@ -718,13 +733,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[yy_current_state]; yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 45 ) if ( yy_current_state >= 66 )
yy_c = yy_meta[yy_c]; yy_c = yy_meta[yy_c];
} }
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
++yy_cp; ++yy_cp;
} }
while ( yy_base[yy_current_state] != 54 ); while ( yy_base[yy_current_state] != 79 );
yy_find_action: yy_find_action:
yy_act = yy_accept[yy_current_state]; yy_act = yy_accept[yy_current_state];
@ -751,120 +766,166 @@ do_action: /* This label is used only to access EOF actions. */
case 1: case 1:
YY_RULE_SETUP YY_RULE_SETUP
#line 8 "al.lex" #line 8 "al.lex"
{ printf("tMAIN\n");} { return tMAIN ;}
YY_BREAK YY_BREAK
case 2: case 2:
YY_RULE_SETUP YY_RULE_SETUP
#line 9 "al.lex" #line 9 "al.lex"
{ printf("tOBRACKET\n"); } { return tOBRACKET;}
YY_BREAK YY_BREAK
case 3: case 3:
YY_RULE_SETUP YY_RULE_SETUP
#line 10 "al.lex" #line 10 "al.lex"
{ printf("tCBRACKET\n"); } { return tCBRACKET; }
YY_BREAK YY_BREAK
case 4: case 4:
YY_RULE_SETUP YY_RULE_SETUP
#line 11 "al.lex" #line 11 "al.lex"
{ printf("tOBRACE\n"); } { return tOBRACE; }
YY_BREAK YY_BREAK
case 5: case 5:
YY_RULE_SETUP YY_RULE_SETUP
#line 12 "al.lex" #line 12 "al.lex"
{ printf("tOBRACE\n"); } { return tCBRACE; }
YY_BREAK YY_BREAK
case 6: case 6:
YY_RULE_SETUP YY_RULE_SETUP
#line 13 "al.lex" #line 13 "al.lex"
{ printf("tCONST\n"); } { return tCONST; }
YY_BREAK YY_BREAK
case 7: case 7:
YY_RULE_SETUP YY_RULE_SETUP
#line 14 "al.lex" #line 14 "al.lex"
{ printf("tINT\n"); } { return tINT; }
YY_BREAK YY_BREAK
case 8: case 8:
YY_RULE_SETUP YY_RULE_SETUP
#line 15 "al.lex" #line 15 "al.lex"
{ printf("tPRINTF\n"); } //Degeu mais à degager { return tPRINTF; } //Degeu mais à degager
YY_BREAK YY_BREAK
case 9: case 9:
YY_RULE_SETUP YY_RULE_SETUP
#line 20 "al.lex" #line 16 "al.lex"
{ printf("tNB\n"); } { return tIF; }
YY_BREAK YY_BREAK
case 10: case 10:
YY_RULE_SETUP YY_RULE_SETUP
#line 21 "al.lex" #line 17 "al.lex"
{ printf("tNBEXP\n"); } { return tWHILE; }
YY_BREAK YY_BREAK
case 11: case 11:
YY_RULE_SETUP YY_RULE_SETUP
#line 22 "al.lex" #line 18 "al.lex"
{ printf("tADD\n"); } { return tLT; }
YY_BREAK YY_BREAK
case 12: case 12:
YY_RULE_SETUP YY_RULE_SETUP
#line 23 "al.lex" #line 19 "al.lex"
{ printf("tSUB\n"); } { return tGT; }
YY_BREAK YY_BREAK
case 13: case 13:
YY_RULE_SETUP YY_RULE_SETUP
#line 24 "al.lex" #line 20 "al.lex"
{ printf("tMUL\n"); } { return tEQCOND; }
YY_BREAK YY_BREAK
case 14: case 14:
YY_RULE_SETUP YY_RULE_SETUP
#line 25 "al.lex" #line 21 "al.lex"
{ printf("tDIV\n"); } { return tAND; }
YY_BREAK YY_BREAK
case 15: case 15:
YY_RULE_SETUP YY_RULE_SETUP
#line 26 "al.lex" #line 22 "al.lex"
{ printf("tEQ\n"); } { return tOR; }
YY_BREAK YY_BREAK
case 16: case 16:
YY_RULE_SETUP YY_RULE_SETUP
#line 27 "al.lex" #line 23 "al.lex"
{ printf("tPV\n"); } { return tELSE;}
YY_BREAK YY_BREAK
case 17: case 17:
YY_RULE_SETUP YY_RULE_SETUP
#line 28 "al.lex" #line 26 "al.lex"
{ printf("tSPACE\n"); } { yylval.nombre = atoi(yytext); return tNB; }
YY_BREAK YY_BREAK
case 18: case 18:
YY_RULE_SETUP YY_RULE_SETUP
#line 29 "al.lex" #line 27 "al.lex"
{ printf("tTAB\n"); } { yylval.nombre = -1; return tNBEXP; } //Renvoyer le token tNB et pas tNBEXP
YY_BREAK YY_BREAK
case 19: case 19:
YY_RULE_SETUP YY_RULE_SETUP
#line 30 "al.lex" #line 28 "al.lex"
{ printf("tCOMA\n"); } { return tADD; }
YY_BREAK YY_BREAK
case 20: case 20:
/* rule 20 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 31 "al.lex" #line 29 "al.lex"
{ printf("tRC\n") ; } { return tSUB; }
YY_BREAK YY_BREAK
case 21: case 21:
YY_RULE_SETUP YY_RULE_SETUP
#line 32 "al.lex" #line 30 "al.lex"
{ printf("tID\n"); } { return tMUL; }
YY_BREAK YY_BREAK
case 22: case 22:
YY_RULE_SETUP YY_RULE_SETUP
#line 33 "al.lex" #line 31 "al.lex"
{ return tERROR; } { return tDIV; }
YY_BREAK YY_BREAK
case 23: case 23:
YY_RULE_SETUP YY_RULE_SETUP
#line 32 "al.lex"
{ return tEQ; }
YY_BREAK
case 24:
YY_RULE_SETUP
#line 33 "al.lex"
{ return tPV; }
YY_BREAK
case 25:
YY_RULE_SETUP
#line 34 "al.lex"
{} //Ne pas les retourner à Yacc
YY_BREAK
case 26:
YY_RULE_SETUP
#line 35 "al.lex" #line 35 "al.lex"
{} //Ne pas les retourner à Yacc
YY_BREAK
case 27:
YY_RULE_SETUP
#line 36 "al.lex"
{ return tCOMA; }
YY_BREAK
case 28:
/* rule 28 can match eol */
YY_RULE_SETUP
#line 37 "al.lex"
{ printf("commentaire\n");}
YY_BREAK
case 29:
/* rule 29 can match eol */
YY_RULE_SETUP
#line 38 "al.lex"
{} //Ne pas les retourner à Yacc
YY_BREAK
case 30:
YY_RULE_SETUP
#line 39 "al.lex"
{ strcpy(yylval.id, yytext); return tID; }
YY_BREAK
case 31:
YY_RULE_SETUP
#line 40 "al.lex"
{ return tERROR; }
YY_BREAK
case 32:
YY_RULE_SETUP
#line 42 "al.lex"
ECHO; ECHO;
YY_BREAK YY_BREAK
#line 868 "lex.yy.c" #line 929 "lex.yy.c"
case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(INITIAL):
yyterminate(); yyterminate();
@ -1161,7 +1222,7 @@ static int yy_get_next_buffer (void)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[yy_current_state]; yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 45 ) if ( yy_current_state >= 66 )
yy_c = yy_meta[yy_c]; yy_c = yy_meta[yy_c];
} }
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
@ -1189,11 +1250,11 @@ static int yy_get_next_buffer (void)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[yy_current_state]; yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 45 ) if ( yy_current_state >= 66 )
yy_c = yy_meta[yy_c]; yy_c = yy_meta[yy_c];
} }
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
yy_is_jam = (yy_current_state == 44); yy_is_jam = (yy_current_state == 65);
return yy_is_jam ? 0 : yy_current_state; return yy_is_jam ? 0 : yy_current_state;
} }
@ -1869,7 +1930,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables" #define YYTABLES_NAME "yytables"
#line 35 "al.lex" #line 42 "al.lex"

View file

@ -1,7 +1,17 @@
#include <stdio.h>
int main(int x, int i){ int main(int x, int i){
int azertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbn; printf("%d\n", azertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbn); const int a = 4;
int y = 2; const int a, b, c = 2 + a - 5 * (7 / 8);
printf(coucou);
int y = 7e8;
int res_2 = x + y; int res_2 = x + y;
if ( (a == 2) && b || c > (7*8)) {
}
else if (a) {
int x = 90;
} else {
int a = b;
}
/* SAlut Elies */
printf(i);
} }

View file

@ -1,7 +0,0 @@
#include <stdio.h>
int main(int x, int i){
int azertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbn; printf("%d\n", azertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbnazertyuiopqsdfghjklmwxcvbn);
int y = 2;
int res_2 = x + y;
}

View file

View file