CodeBus
www.codebus.net
Search
Sign in
Sign up
Hot Search :
Source
embeded
web
remote control
p2p
game
More...
Location :
Home
Search - h.3
Main Category
SourceCode
Documents
Books
WEB Code
Develop Tools
Other resource
Sub Category
assembly language
SCSI-ASPI
ELanguage
Disk Tools
Speech/Voice recognition/combine
Editor
Anti-virus
MultiLanguage
MPI
source in ebook
Delphi VCL
OS Develop
MiddleWare
MacOS develop
LabView
e-language
python
Search - h.3 - List
[
ELanguage
]
LL(1)yufafenxi
DL : 0
*--- --- --声明--- --- -----*/ /* VC6.0下运行通过 此程序为本人苦心所做,请您在阅读的时候,尊重本人的 劳动。可以修改,但当做的每一处矫正或改进时,请将改进 方案,及修改部分发给本人 (修改部分请注名明:修改字样) Email: jink2005@sina.com QQ: 272576320 ——初稿完成:06-5-27 jink2005 补充: 程序存在问题: (1) follow集不能处理:U->xVyVz的情况 (2) 因本人偷懒,本程序为加入文法判断,故 输入的文法必须为LL(1)文法 (3) 您可以帮忙扩充:消除左递归,提取公因子等函数 (4) …… */ /*-----------------------------------------------*/ /*参考书《计算机编译原理——编译程序构造实践》 LL(1)语法分析,例1: ERTWF# +*()i# 文法G[E]:(按此格式输入) 1 E -> TR 2 R -> +TR 3 R -> 4 T -> FW 5 W -> * FW 6 W -> 7 F -> (E) 8 F -> i 分析例句:i*(i)# , i+i# 例2: 编译书5.6例题1 SHMA# adbe# S->aH H->aMd H->d M->Ab M-> A->aM A->e 分析例句:aaabd# */
Date
: 2008-10-13
Size
: 5.16kb
User
:
林月忠
[
ELanguage
]
pl/0
DL : 0
/*PL/0编译系统C版本头文件pl0.h*/ /* typedef enum { false, true } bool; */ #define norw 13 /*关键字个数*/ #define txmax 100 /*名字表容量*/ #define nmax 14 /*number的最大位数*/ #define al 10 /*符号的最大长度*/ #define amax 2047 /*地址上界*/ #define levmax 3 /*最大允许过程嵌套声明层数[0,levmax]*/ #define cxmax 200 /*最多的虚拟机代码数*/ /*符号*/ enum symbol{ nul, ident, number, plus, minus, times, slash, oddsym, eql, neq, lss, leq, gtr, geq, lparen, rparen, comma, semicolon, period, becomes, beginsym, endsym, ifsym, thensym, whilesym, writesym, readsym, dosym, callsym, constsym, varsym, procsym, }; #define symnum 32 /*名字表中的类型*/ enum object{ constant, variable, procedur, }; /*虚拟机代码*/ enum fct{ lit, opr, lod, sto, cal, inte, jmp, jpc, }; #define fctnum 8 /*虚拟机结构代码*/ struct instruction { /*454*/ enum fct f; // 虚拟机代码指令 int l; //引用层与声明层的层次差 int a; //根据f的不同而不同 }; FILE * fas; //输出名字表 FILE * fa; //输出虚拟机代码 FILE * fa1; //输出源文件及其各行对应的首地址 FILE * fa2; //输出结果 bool listswitch; //显示虚拟机代码与否 bool tableswitch; //显示名字与否 char ch; //获取字符的缓冲区,getch使用 enum symbol sym; //当前的符号 char id[al+1]; //当前ident,多出的一个字节用于存放0 int num; //当前number int cc,ll; //getch使用的计数器,cc表示当前字符(ch)的位置 int cx; //虚拟机代码指针,取值范围[0,cxmax-1] char line[81]; //读取行缓冲区 char a[al+1]; //临时符号,多出的一个字节用于存放0 struct instruction code[cxmax]; //存放虚拟机代码的数组 char word[norw][al]; //保留字 enum symbol wsym[norw]; //保留字对应的符号值 enum symbol ssym[256]; //单字符的符号值 char mnemonic[fctnum][5]; //虚拟机代码指令名称 bool declbegsys[symnum]; //表示声明开始的符号集合 bool statbegsys[symnum]; //表示语句开始的符号集合 bool facbegsys[symnum]; //表示因子开始的符号集合 //名字表结构 struct tablestruct { char name[al]; //名字 enum object kind; //类型:const,var,array or procedure int val; //数值,仅const使用 int level; //所须层,仅const不能用 int adr; //地址,仅const不能用 int size; //需要分配的数据空间,仅procedure使用 }; struct tablestruct table[txmax]; //名字表 FILE * fin; FILE * fout; char fname[al]; int err; //错误计数器 //当函数中发生fatal error时,返回-1告知调用它的函数,最终退出程序 #define getsymdo if(-1==getsym()) return -1 #define getchdo if(-1==getch()) return -1 #define testdo(a,b,c) if(-1==test(a,b,c)) return -1 #define gendo(a,b,c) if(-1==gen(a,b,c)) return -1 #define expressiondo(a,b,c) if(-1==expression(a,b,c)) return -1 #define factordo(a,b,c) if(-1==factor(a,b,c)) return -1 #define termdo(a,b,c) if(-1==term(a,b,c)) return -1 #define conditiondo(a,b,c) if(-1==condition(a,b,c)) return -1 #define statementdo(a,b,c) if(-1==statement(a,b,c)) return -1 #define constdeclarationdo(a,b,c) if(-1==constdeclaration(a,b,c)) return -1 #define vardeclarationdo(a,b,c) if(-1==vardeclaration(a,b,c)) return -1 void error(int n); int getsym(); int getch(); void init(); int gen(enum fct x,int y ,int z); int test(bool *s1,bool *s2,int n); int inset(int e,bool *s); int addset(bool *str,bool * s1,bool * s2,int n); int subset(bool *str,bool * s1,bool * s2,int n); int mulset(bool *str,bool * s1,bool * s2,int n); int block(int lev,int tx,bool * fsys); void interpret(); int factor(bool * fsys,int * ptx,int lev); int term(bool * fsys,int * ptx,int lev); int condition(bool * fsys,int * ptx,int lev); int expression(bool * fsys,int * ptx,int lev); int statement(bool * fsys,int * ptx,int lev); void listcode(int cx0); int vardeclaration(int *ptr, int lev,int *ptx); int constdeclaration(int *ptr, int lev,int *ptx); int position(char * idt,int tx); void enter(enum object k,int * ptx,int lev, int * pdx); int base(int l,int * s,int b)
Date
: 2010-09-13
Size
: 24.55kb
User
:
xqq771084591
[
ELanguage
]
faad2-3.0
DL : 0
mpeg4 aac 音频解码 开放免费代码 -mpeg4 aac audio decoder free open code
Date
: 2025-12-16
Size
: 959kb
User
:
yff
[
ELanguage
]
LL(1)yufafenxi
DL : 0
*--- --- --声明--- --- -----*/ /* VC6.0下运行通过 此程序为本人苦心所做,请您在阅读的时候,尊重本人的 劳动。可以修改,但当做的每一处矫正或改进时,请将改进 方案,及修改部分发给本人 (修改部分请注名明:修改字样) Email: jink2005@sina.com QQ: 272576320 ——初稿完成:06-5-27 jink2005 补充: 程序存在问题: (1) follow集不能处理:U->xVyVz的情况 (2) 因本人偷懒,本程序为加入文法判断,故 输入的文法必须为LL(1)文法 (3) 您可以帮忙扩充:消除左递归,提取公因子等函数 (4) …… */ /*-----------------------------------------------*/ /*参考书《计算机编译原理——编译程序构造实践》 LL(1)语法分析,例1: ERTWF# +*()i# 文法G[E]:(按此格式输入) 1 E -> TR 2 R -> +TR 3 R -> 4 T -> FW 5 W -> * FW 6 W -> 7 F -> (E) 8 F -> i 分析例句:i*(i)# , i+i# 例2: 编译书5.6例题1 SHMA# adbe# S->aH H->aMd H->d M->Ab M-> A->aM A->e 分析例句:aaabd# */-err
Date
: 2025-12-16
Size
: 5kb
User
:
[
ELanguage
]
lexical_analyzer
DL : 0
C语言词法分析器 by wpc_LK 这是一个简单的词法分析器,不能避免的存在错误请大家指出予以纠正,谢谢! 示例语句 include<stdio.h> int main{ int a=3,b=4,c if((a+b)==7)c=1 else c=0 return 0 } 输入 exit 退出程序。-C language lexical analyzer by wpc_LK This is a simple lexical analyzer can t avoid that there re some errors here,please correct, thank you! for exzample: include<stdio.h> int main{ int a=3,b=4,c if((a+b)==7)c=1 else c=0 return 0 } input exit quit the program.
Date
: 2025-12-16
Size
: 12kb
User
:
wzl
[
ELanguage
]
DVD2AVI_164_SRC
DL : 0
Dvd to AVI DVD2AVI is based on MSSG MPEG2Decode-1. GUI interface (gui.cpp) 2. VFAPI support (vfapi.c vfapidec.c) 3. AC3/MPA/LPCM demux (getbit.c) 4. Auto-split AVI output through RGB24/YUY2 (store.c) 5. YUY2 DirectDraw Overlay (store.c gui.cpp) 6. revised I/O routine (getbit.c getbic.h) 7. MMX-optimized motion compensation (recon.c getpic.c) 8. MMX-optimized color space conversion (store.c) 9. audio normalization (norm.c)
Date
: 2025-12-16
Size
: 154kb
User
:
李林
[
ELanguage
]
pl0word
DL : 0
编译原理 pl0 语言的词法分析程序 本次提供的源码包括3个文件:pl0.h,pl0.c,test.txt:-Compiler theory pl0 language lexical analysis program to provide the source code of this file, including 3: pl0.h, pl0.c, test.txt:
Date
: 2025-12-16
Size
: 87kb
User
:
candy
[
ELanguage
]
X86IEE32
DL : 0
这个东西可以帮你解析执行32位的X86指令。不包括FPU,也不包括MMX之类的东西。代码符合C99标准,理论上应该没限制的,不过根据不同的编译器实现,需要修改下cpu_BasicType.h类型定义。测试时在VS2005(禁止语言扩展特性、/W4)和GCC 3.4(-std=c99 -O1或者-ansi -O1)中编译通过-This thing can help you resolve the implementation of the X86 32-bit instructions. Not including FPU, nor does it include things like MMX. Code meets the standard C99, in theory, should be no limit, but depending on the compiler implementation, need to be modified under the cpu_BasicType.h type definition. When tested in VS2005 (Extended Prohibition of language features,/W4), and GCC 3.4 (-std = c99-O1 or-ansi-O1) in the compiler
Date
: 2025-12-16
Size
: 70kb
User
:
ucsm
[
ELanguage
]
PL0Compiler-C
DL : 0
PL/0编译器C++/C版本 1. 测试文件必须是以testin.pl0命名的文件。 2. 成功运行测试程序后,会生成testout.txt的文件,里面包括代码、指令和运行结果。 3、First.cpp--只包含词法语法分析,Error.cpp--加入了出错处理,All.cpp--包含代码生成和解释程序,是完整编译器。-请键入文字或网站地址,或者上传文档。 取消 PL/0 biānyì qì C++/C bǎnběn 1. Cèshì wénjiàn bìxū shì yǐ testin.Pl0 mìngmíng de wénjiàn. 2. Chénggōng yùnxíng cèshì chéngxù hòu, huì shēngchéng testout.Txt de wénjiàn, lǐmiàn bāokuò dàimǎ, zhǐlìng hé yùn háng jiéguǒ. 3,First.Cpp--zhǐ bāohán cífǎ yǔfǎ fēnxī,Error.Cpp--jiārùle chūcuò chu lǐ,All.Cpp--bāohán dàimǎ shēngchéng hé jiěshì chéngxù, shì wánzhěng biānyì qì. 您是不是要找: pascal 子语言 pl 0编译器 解释器 pascal编写 PL/0 compiler C++/C version 1 test file named file must be based testin.pl0. (2) After successfully running the test program will generate testout.txt file, which includes the code, instructions and operating results. 3, First.cpp-- contains only syntax analysis, Error.cpp-- added error handling, All.cpp-- include code generation and interpretation procedures are complete compiler.
Date
: 2025-12-16
Size
: 10kb
User
:
夏日星
[
ELanguage
]
Y
DL : 1
采用flex工具进行词法分析并结合yacc工具进行语法分析生成文法编译器 进行了完整的词法、语法分析 初始源文件4个:19210216.l,19210216.y,code.h,table.h, 运行过程: 先写出词法分析*.l文件和语法分析*.y文件。 然后运行CMD,进入DOS下,将目录切换到flex和bison及源码所在目录 1、flex 19210216.l 生成lex.yy.c 2、bison -d 19210216.y 生成19210216_tab.c和19210216_tab.h两个文件 3、使用vc++6.0建立一个project,把lex.yy.c,19210216.tab.c,19210216.tab.h,code.h,table.h添加进去,编译并且build,然后运行 生成执行文件。 4、编写7个文本文件的测试代码,运行执行文件,并将测试代码文件名写入 若该目录下没有此文件名,则会提示没有此文件 若该目录下有此文件,则询问是否进行编译,输入“y ,会输出结果,是否正确。 -采用flex工具进行词法分析并结合yacc工具进行语法分析生成文法编译器 进行了完整的词法、语法分析 初始源文件4个:19210216.l,19210216.y,code.h,table.h, 运行过程: 先写出词法分析*.l文件和语法分析*.y文件。 然后运行CMD,进入DOS下,将目录切换到flex和bison及源码所在目录 1、flex 19210216.l 生成lex.yy.c 2、bison-d 19210216.y 生成19210216_tab.c和19210216_tab.h两个文件 3、使用vc++6.0建立一个project,把lex.yy.c,19210216.tab.c,19210216.tab.h,code.h,table.h添加进去,编译并且build,然后运行 生成执行文件。 4、编写7个文本文件的测试代码,运行执行文件,并将测试代码文件名写入 若该目录下没有此文件名,则会提示没有此文件 若该目录下有此文件,则询问是否进行编译,输入“y ,会输出结果,是否正确。
Date
: 2025-12-16
Size
: 420kb
User
:
曹鲁豫
CodeBus
is one of the largest source code repositories on the Internet!
Contact us :
1999-2046
CodeBus
All Rights Reserved.