[ZZ]bison flex for windows 使用说明
来源:互联网 发布:捕鱼3d源码 编辑:程序博客网 时间:2024/04/30 01:19
you will need the lastest versions of:
flex-2.5.4a-1.exe
bison-2.4.1-setup.exe
After that, do a full install in a directory of your preference without spaces in the name. I suggest
C:\GnuWin32
. Do not install it in the default (C:\Program Files (x86)\GnuWin32) because bison has problems with spaces in directory names, not to say parenthesis.Also, consider installing Dev-CPP in the default directory (
C:\Dev-Cpp
)After that, set the PATH variable to include the bin directories of
gcc
(inC:\Dev-Cpp\bin
) andflex\bison
(inC:\GnuWin32\bin
). To do that, copy this:;C:\Dev-Cpp\bin;C:\GnuWin32\bin
and append it to the end of thePATH
variable, defined in the place show by this figure:
If the figure is not in good resolution, you can see a step-by-step here.Open a prompt, cd to the directory where your ".l" and ".y" are, and compile them with:
flex hello.l
bison -dy hello.y
gcc lex.yy.c y.tab.c -o hello.exe
You will be able to run the program. I made the sources for a simple test (the infamous Hello World
):
Hello.l
%{ #include <stdlib.h> #include "y.tab.h" %} %% ("hi"|"oi")"\n" { return HI; } ("tchau"|"bye")"\n" { return BYE; } . { yyerror(); } %% int main(void) { yyparse(); return 0; } int yywrap(void) { return 0; } int yyerror(void) { printf("Error\n"); exit(1); }
Hello.y
%token HI BYE%%program: hi bye ;hi: HI { printf("Hello World\n"); } ;bye: BYE { printf("Bye World\n"); exit(0); } ;
- [ZZ]bison flex for windows 使用说明
- 编译器工具 Flex Bison for Windows 简单入门例子
- Bison for Windows
- 使用bison和flex工具[zz]
- 在windows下安装flex和bison
- WINDOWS下bison和flex的使用
- 使用Flex Bison 和LLVM编写自己的编译器[zz]
- flex bison
- bison & flex
- flex&bison
- flex bison
- flex&&bison
- Windows下安装lex(flex)与yacc(bison)
- 编译原理 - 在 Windows 平台下使用 Flex 和 Bison
- Flex/Lex&Bison/Yacc
- flex and bison.[link]
- Bison-Flex 笔记
- flex&bison 学习笔记
- Tortoise SVN的几个功能说明
- 【Android】Android中shape的使用
- 编程蛋疼锦集-01-->hibernate中用jdbc操作数据库
- c/c++野指针
- oracle spfile和pfile小结
- [ZZ]bison flex for windows 使用说明
- oracle 获得两个时间相差的秒数
- spring 事务配置 一
- ARM 汇编的必知必会
- spring 事务管理 二
- Google广告可以被关闭 并由Google重新推荐新的广告类型
- Linux中通过shell进行数据计算
- lua的一些细节
- Oracle 9i pfile/spfile 参数文件详解