I have this problem where my YACC file doesn't seem to be able to access types defined in my header file.
If I replace my header file with %code requires{ }
it does recognize it but that is not really what I want.
My st.h header file:
struct node {
int item;
int identifier;
struct node *left;
struct node *middle;
struct node *right;
};
typedef struct node NODE;
typedef NODE *TREE;
My parser.y file:
%{
#include <stdio.h>
#include <stdlib.h>
#include "st.h"
%}
%union {
int value;
TREE token;
}
Yacc (or C) gives me this error:
error: unknown type name ‘TREE’
I understand that this is most likely a mistake on my end and I would greatly appreciate any help.
typedef
a pointer! And read How to Ask, provide all required information. It should be no problem to specify the exact error message, which it originates from and where it arises. – too honest for this site