(과학적인) C 프로그램을위한 간단한 입력 출력 라이브러리와 함께 사용하기 위해 간단한 어휘 분석기를 작성하려고합니다. automake에, libtool이, 그리고 autoconf를 포함 autotools를, 컴파일 할 때, 나는 다음과 같은 오류가 발생합니다 :flex 파일의 컴파일 오류
simpleio_lex.l:41: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘of’
이 보통 내가 함수 프로토 타입의 끝에 세미콜론을 잊어 버린,하지만 난 확인한 것을 의미 내 헤더와 같은 누락이 없습니다.
여기 simpleio_lex.l 같습니다
는%{
int yylex(void);
#define yylex sio_lex
#include "simpleio.h"
%}
NUM [0-9] /* a number */
FLOAT {NUM}+"."{NUM}* /* a floating point number */
FLOATSEQ {FLOAT[[:space:]]?}+
FLOATLN ^FLOATSEQ$
SYMBOL [a-z]+ /* a symbol always comes at the
beginning of a line */
SYMDEF ^SYMBOL[[:space:]]*FLOAT /* define a single value for a symbol */
RANGE FLOAT":"FLOAT":"FLOAT /* a range of numbers */
SYMRANGE ^SYMBOL[[:space:]]+RANGE$ /* assign a range of values to a symbol */
%%
/* a set of lines with just numbers
indicates we should parse it as data */
{FLOATLN}+ sio_read_stk_inits (yytext);
SYMDEF sio_read_parse_symdef (yytext);
SYMRANGE sio_read_parse_symrange (yytext);
%%
/* might as well define these here */
sio_symdef_t *
sio_read_parse_symdef (char * symdef)
{
sio_symdef_t * def = malloc (sizeof (sio_symdef_t));
/* split the string into tokens on the LHS and RHS */
char * delim = " ";
char * lvalue = strtok (symdef, delim);
size_t lsize = sizeof (lvalue);
char * rest = strtok (NULL, delim);
double plval; /* place holder */
int s_ck = sscanf (rest, "%lg", &plval);
if (s_ck == EOF)
return NULL;
else
{
def->value = plval;
def->name = malloc (lsize);
memcpy(def->name, lvalue, lsize);
}
return def;
}
이멕스의 *compilation*
버퍼 하이퍼 링크 프리앰블 끝에 %}%
날을 말한다. 이 오류가 발생하는 이유는 무엇입니까? 나는 "of"이라는 상징이 없다. , 두 번째 줄은 직접 소스로 복사 한
/* this is a comment that's going to run into a
new line */
:
감사합니다,
조엘
이것을 Adobe Flex에 표시 하시겠습니까? – JeffryHouser
아니요. 그는 실제 flex를 의미하지 않았지만 일반적으로 gnu-flex로 태그하므로 'flex'태그가 제거됩니다. –
감사합니다. Simeon - Adobe Flex와 같은 것이 있는지 몰랐습니다. –