[ZZ]bison flex for windows 使用说明
2012-06-19 23:51
375 查看
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
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 (
After that, set the PATH variable to include the bin directories of
and
To do that, copy this:
append it to the end of the
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:
You will be able to run the program. I made the sources for a simple test (the infamous
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(in
C:\Dev-Cpp\bin)
and
flex\bison(in
C:\GnuWin32\bin).
To do that, copy this:
;C:\Dev-Cpp\bin;C:\GnuWin32\binand
append it to the end of the
PATHvariable,
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); } ;
相关文章推荐
- AWStats安装使用说明(For Windows)
- 使用bison和flex工具[zz]
- 编译原理——实验 1.2 在 Windows平台下使用 Flex和 Bison
- windows下安装和使用flex for windows
- 使用Bison和Flex(Windows下的基于GNU开源的Yacc和Lex)
- WINDOWS下bison和flex的使用
- 编译器工具 Flex Bison for Windows 简单入门例子
- 编译原理 - 在 Windows 平台下使用 Flex 和 Bison
- Docker的安装和使用说明——Docker for Windows
- 使用bison和flex工具[zz]
- Docker的安装和使用说明——Docker for Windows
- 编译器工具 Flex Bison for Windows 简单入门例子
- GitHub for Windows 2.0的配置使用
- Github for windows的使用
- 在windows下安装和使用gcc for win
- Nutch 0.8在windows下使用的说明
- CentOS下安装MySQL,Windows下使用Navicat for MySql连接
- Docker for Windows使用简介
- Github for Windows使用介绍
- windows 下Neuxs的安装使用说明