Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help with finishing the lex and yacc files. A thorough explantion with each step please or a step in the right direction. Here
I need help with finishing the lex and yacc files. A thorough explantion with each step please or a step in the right direction. Here are my files thus far. h File #ifndef cilisph #define cilisph #include #include #include #include #include #include #define NANRETVAL RETVALDOUBLETYPE, NAN #define ZERORETVAL RETVALINTTYPE, #define BISONFLEXLOGPATH "bisonflex.log FILE readtarget; FILE flexbisonlogfile; sizet yyreadlinechar lineptr sizet n FILE stream sizet nterminate; int yyparsevoid; int yylexvoid; void yyerrorchar ; void warningchar; typedef enum functype NEGFUNC, ABSFUNC, ADDFUNC, SUBFUNC, MULTFUNC, DIVFUNC, EXPFUNC, REMAINDERFUNC, EXPFUNC, POWFUNC, LOGFUNC, SQRTFUNC, CBRTFUNC, HYPOTFUNC, MAXFUNC, MINFUNC, CUSTOMFUNC FUNCTYPE; FUNCTYPE resolveFuncchar ; typedef enum numtype INTTYPE, DOUBLETYPE, NUMTYPE; typedef struct NUMTYPE type; double value; ASTNUMBER; typedef ASTNUMBER RETVAL; typedef struct astfunction FUNCTYPE func; struct astnode opList; ASTFUNCTION; typedef enum astnodetype NUMNODETYPE, FUNCNODETYPE ASTNODETYPE; typedef struct astnode ASTNODETYPE type; union ASTNUMBER number; ASTFUNCTION function; data; struct astnode next; ASTNODE; ASTNODE createNumberNodedouble value, NUMTYPE type; ASTNODE createFunctionNodeFUNCTYPE func, ASTNODE opList; ASTNODE addExpressionToListASTNODE newExpr ASTNODE exprList; RETVAL evalASTNODE node; void printRetValRETVAL val; void freeNodeASTNODE node; #endif
I need help with finishing the lex and yacc files. A thorough explantion with each step please or a step in the right direction. Here are my files thus far.
h File
#ifndef cilisph
#define cilisph
#include
#include
#include
#include
#include
#include
#define NANRETVAL RETVALDOUBLETYPE, NAN
#define ZERORETVAL RETVALINTTYPE,
#define BISONFLEXLOGPATH "bisonflex.log
FILE readtarget;
FILE flexbisonlogfile;
sizet yyreadlinechar lineptr sizet n FILE stream sizet nterminate;
int yyparsevoid;
int yylexvoid;
void yyerrorchar ;
void warningchar;
typedef enum functype
NEGFUNC,
ABSFUNC,
ADDFUNC,
SUBFUNC,
MULTFUNC,
DIVFUNC,
EXPFUNC,
REMAINDERFUNC,
EXPFUNC,
POWFUNC,
LOGFUNC,
SQRTFUNC,
CBRTFUNC,
HYPOTFUNC,
MAXFUNC,
MINFUNC,
CUSTOMFUNC
FUNCTYPE;
FUNCTYPE resolveFuncchar ;
typedef enum numtype
INTTYPE,
DOUBLETYPE,
NUMTYPE;
typedef struct
NUMTYPE type;
double value;
ASTNUMBER;
typedef ASTNUMBER RETVAL;
typedef struct astfunction
FUNCTYPE func;
struct astnode opList;
ASTFUNCTION;
typedef enum astnodetype
NUMNODETYPE,
FUNCNODETYPE
ASTNODETYPE;
typedef struct astnode
ASTNODETYPE type;
union
ASTNUMBER number;
ASTFUNCTION function;
data;
struct astnode next;
ASTNODE;
ASTNODE createNumberNodedouble value, NUMTYPE type;
ASTNODE createFunctionNodeFUNCTYPE func, ASTNODE opList;
ASTNODE addExpressionToListASTNODE newExpr ASTNODE exprList;
RETVAL evalASTNODE node;
void printRetValRETVAL val;
void freeNodeASTNODE node;
#endif
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started