Untitled

mail@pastecode.io avatar
unknown
c_cpp
23 days ago
959 B
2
Indexable
Never
%{
#include<iostream>
#include<string>
#include<vector>

extern "C" {
	int yyparse();
	int yylex();
}

%union{
struct Node{
	char *token;
	int noterminal, h;
	Node *ch[15];
	Node():token(NULL), noterminal(0), h(0){memset(ch, 0, sizeof(ch));}
	Node(char *yytext):token(NULL), noterminal(0), h(0){
		memset(ch, 0, sizeof(ch));
		int sz = strlen(yytext) + 1;
		token = new char[sz];
		memcpy(token, yytext, sz);
	}
};
}
#define YYSTYPE Node*



-----------------------------------

%{
#include<iostream>
#include<string>
#include<vector>

extern "C" {
	int yyparse();
	int yylex();
}

struct Node{
	char *token;
	int noterminal, h;
	Node *ch[15];
	Node():token(NULL), noterminal(0), h(0){memset(ch, 0, sizeof(ch));}
	Node(char *yytext):token(NULL), noterminal(0), h(0){
		memset(ch, 0, sizeof(ch));
		int sz = strlen(yytext) + 1;
		token = new char[sz];
		memcpy(token, yytext, sz);
	}
};
#define YYSTYPE Node*
Leave a Comment