Structure invalide en lex et yacc
slt a tous,
je programme en lex et yacc
j ai eu un erreure lors de la compillation que je n ai pas pu comprendre (elle est en gras)
[wael@localhost projet]$ lex op.l
[wael@localhost projet]$ yacc -d op.y
[wael@localhost projet]$ cc lex.yy.c -ll -ly -o op
In file included from op.l:4:
op.y:15: error: field ‘expression’ has incomplete type
op.l: In function ‘yylex’:
op.l:22: warning: passing argument 1 of ‘strncpy’ makes pointer from integer without a cast
[wael@localhost projet]$
et voici le debut du fichier op.l
.....................................................
%{
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include¨structures.h¨
#include "y.tab.h"
struct var_cel *var_list=NULL;
%}
%union {
char chaine;
struct expr expression;
}
%token <chaine> VAR
......................................................
et voici le fichier structures.h
........................................................
typedef struct {
int type;
float val;
} expr;
typedef struct {
char id[20];
float val;
int type;/*egale a 0 si booleen et 1 si reel*/
var_cel *suivant;} var_cel;
.................................................
svp aidez moi
et merci d avance
je programme en lex et yacc
j ai eu un erreure lors de la compillation que je n ai pas pu comprendre (elle est en gras)
[wael@localhost projet]$ lex op.l
[wael@localhost projet]$ yacc -d op.y
[wael@localhost projet]$ cc lex.yy.c -ll -ly -o op
In file included from op.l:4:
op.y:15: error: field ‘expression’ has incomplete type
op.l: In function ‘yylex’:
op.l:22: warning: passing argument 1 of ‘strncpy’ makes pointer from integer without a cast
[wael@localhost projet]$
et voici le debut du fichier op.l
.....................................................
%{
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include¨structures.h¨
#include "y.tab.h"
struct var_cel *var_list=NULL;
%}
%union {
char chaine;
struct expr expression;
}
%token <chaine> VAR
......................................................
et voici le fichier structures.h
........................................................
typedef struct {
int type;
float val;
} expr;
typedef struct {
char id[20];
float val;
int type;/*egale a 0 si booleen et 1 si reel*/
var_cel *suivant;} var_cel;
.................................................
svp aidez moi
et merci d avance
A voir également:
- Structure invalide en lex et yacc
- Logiciel calcul structure bois gratuit - Télécharger - Architecture & Déco
- Captcha invalide ✓ - Forum Mozilla Firefox
- Coupon pcs invalide ✓ - Forum Consommation & Internet
- Iptv url invalide ✓ - Forum Box et Streaming vidéo
- Session invalide ou obsolète - Forum Consommation & Internet
4 réponses
Effectivement si la structure expr n'est pas définie ça ne peut pas compiler. Je t'invite à repartir d'un tutoriel :
http://www.linux-france.org/article/devl/lexyacc/minimanlexyacc.html#toc4
Bonne chance
http://www.linux-france.org/article/devl/lexyacc/minimanlexyacc.html#toc4
Bonne chance
slt,
merci mamiemando
mais en effet ¨expression¨ n est pas une structure c est un type de token comme ¨chaine¨
%union {
char chaine;
struct expr expression;
}
et ¨expr¨ est definie dans le fichier structures.h
typedef struct {
int type;
float val;
} expr;
j ai pa compri c'est quoi le probleme
merci d´avance d´aider un pauvre etudiant pour terminer son projet
merci mamiemando
mais en effet ¨expression¨ n est pas une structure c est un type de token comme ¨chaine¨
%union {
char chaine;
struct expr expression;
}
et ¨expr¨ est definie dans le fichier structures.h
typedef struct {
int type;
float val;
} expr;
j ai pa compri c'est quoi le probleme
merci d´avance d´aider un pauvre etudiant pour terminer son projet