YACC에서 SKELETON.C???
이게 어디다 쓰는 파일인지??? 설명 보면 이걸루 Yacc를
만들라구 하는데 -_-;;;
제가 파일을 하나 다운 받았는데 밑에 처럼 되어 있네요.
다른건 대충 이해 하겠는데 도무지 3번 4번 8번이
이해가 잘 안가네요 많은 도움 부탁 드립니다.
FREEGRM5.TXT This introductory file
GRAMMAR5.TXT Parsing ambiguities in C++, and in my grammar
CPP5.Y My YACC compatible C++ grammar
C5.Y My YACC compatible, ANSI C conformant grammar
CPP5.L Flex input file defining a C++ lexical analyzer
SKELGRPH.C A hacked file from the Berkeley YACC distribution
AUTODOC5.TXT Documentation for my machine generated analysis
Y.OUTPUT Machine generated analysis of the C++ grammar.
1) Get the entire source for Berkeley YACC 1.8 1/2/91
2) Verify that you can make the YACC
3) Rename SKELETON.C to SKELOLD.C, and implant SKELGRPH.C in that directory as SKELETON.C
4) Make the yacc using this new SKELETON.C
5) Using the above yacc, process my CPP5.Y file
yacc -dvl cpp5.y
The result should be a file y.tab.c, and y.tab.h
6) Using Flex (replacement for lex) to process my CPP5.L file
flex cpp5.l
the result should be yy.lex.c
7) Compile the two files
cc -o cpp5 y.tab.c yy.lex.c
the result should be an executable called cpp5
8) Set the environment variable YYDEBUG to 6
setenv YYDEBUG 6
If you don't do this, the graphical output will not appear!
9) Run the program cpp5
cpp5
10) Try the input
int a;
11) You should see a nice parse tree. Enjoy. Note that
the lexer DOES NOT INCLUDE A SYMBOL TABLE, and does
NOT KEEP TRACK OF CURRENT SCOPES. The hack (see the
CPP5.L file for details) is to assume that any identifier
that begins with a capital letter is a typedef name
Send complaints about code that doesn't parse "correctly".
흠...
무엇을 모르시겠다는건지???
보니 Yacc 를 특정 기능으로 패치하는 것 같은데요.
1번에서 Yacc 소스를 통째로 받으라고 했잖아요.
3번은 그 Yacc 소스를 풀어서 찾아보면 어딘가 skeleton.c 란게 있을테니 그걸 딴이름으로 일단 백업하고, 가지고 계신 skelgrph.c 를 skeleton.c 로 이름을 바꾸어서 거기에 복사해넣으란 이야기죠.
4번은 이렇게 skeleton.c 만 바꾸어치기한 yacc 소스를 통째로 컴파일하란 이야기고요.
5번에서 쓸 yacc 는 이렇게 빌드한 놈을 쓰란 이야기겠죠?
...
8번은 환경변수 세팅해주란 이야기고요...
흠. 좀 이상하긴 하지만, 암튼 행운을 빌어요~
vio:
댓글 달기