我正在尝试解析以下几行:
BEGIN WRAP WIO3
NAME lgCell_prg160_io
CONDITION UNI_PLACE_GLOBAL && compBits
ENDS WIO3
Run Code Online (Sandbox Code Playgroud)
我用来解析上面几行的语法正在解析直到UNI_PLACE_GLOBAL然后它给出解析错误。
请帮助我找出我所犯的错误。
我认为它不接受空格,所以我怎样才能允许解析这些行?
我已经做好了
莱克斯.l
%{
#include <iostream>
#include <stdio.h>
const char s[2] = " ";
#include "yacca.tab.h"
char *token;
#define YY_DECL extern "C" int yylex()
int line_num = 1;
#ifdef DEBUG
#define RETURN(x) cerr << "\n--> found " << #x << "\n"; return x;
#else
#define RETURN(x) return x;
#endif
using namespace std;
%}
DOT "."
COLON ":"
SEMICOLON ";"
COMMA ","
ANGLE_LEFT "<"
ANGLE_RIGHT …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 flex 和 bison 解析一个输入文件,但在编译我的程序时遇到了一个困难。我附上了我的 flex 和 bison 代码以及我得到的错误。
请帮我解决这些错误
lex.l
%{
#include <iostream>
#include <stdio.h>
#include "yacc.tab.h"
#define YY_DECL extern "C" int yylex()
using namespace std;
%}
DOT "."
COLON ":"
SEMICOLON ";"
COMMA ","
ANGLE_LEFT "<"
ANGLE_RIGHT ">"
AT "@"
EQUAL "="
SQUARE_OPEN "["
SQUARE_CLOSE [^\\]"]"
OPENBRACE "\("
CLOSEBRACE "\)"
QUOTE "\""
QUOTE_OPEN "\""
QUOTE_CLOSE [^\\]"\""
SPACE " "
TAB "\t"
CRLF "\r\n"
QUOTED_PAIR "\\"[^\r\n]
DIGIT [0-9]
ALPHA [a-zA-Z]
QTEXT [0-9a-zA-Z!#$%&'()*+,\-.\/:;<=>?@\[\]^_`{|}~]
%%
[a-zA-Z0-9]+ { yylval.sval = strdup(yytext); return …Run Code Online (Sandbox Code Playgroud)