2008年12月13日
摘要: 实现计算功能,可以由代码计算出变量的值 呵呵 赶紧睡觉去 Code Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->using System; using System.Collections.Generic; using System.... 阅读全文
posted @ 2008-12-13 23:52 feathersky 阅读(578) 评论(0) 推荐(0) 编辑
摘要: 实现编译 int a,b=5,c=4; int d,e; a=5; a=a+b*c+100; d=a+b; 产生式如下 Statement->st{st} //声明变量 st->int st1{,st1} ; st1->i{=i}; Body->S{S} //主体赋值表达式 S->i=E; E->T{+T} T->i{*T} Code->{... 阅读全文
posted @ 2008-12-13 23:02 feathersky 阅读(475) 评论(0) 推荐(0) 编辑
摘要: 令产生式为 S->T=E; E->T{+T}; T->F{*F}, F->i; 代码如下 很垃圾的代码 乱写的 仅仅做个示范 很多东西要改 呵呵 把a = a + 10 + b * 10 * 3 + c ;编译成"T0=a+10; T1=b*10; T2=T1*3; T3=T0+T2; T4=T3+c; a=T4; " 减法 除法等同处理即可 Code Code ... 阅读全文
posted @ 2008-12-13 21:39 feathersky 阅读(635) 评论(3) 推荐(0) 编辑
摘要: 先学习一个最简单的 编译如下代码 " a + 10 + b + c ; "; 关键字为{ "int", "+", "=", ";", "i" }; "i"表示变量或数字 Code 下面的代码一个是产生临时变量,一个是产生四元表达式 Code Code highlighting produced by Actipro CodeHighlighter (freeware)... 阅读全文
posted @ 2008-12-13 21:17 feathersky 阅读(201) 评论(0) 推荐(0) 编辑
摘要: 先学习一个最简单的 编译如下代码 " a + 10 + b + c ; "; 关键字为{ "int", "+", "=", ";", "i" }; "i"表示变量或数字 Code 下面的代码一个是产生临时变量,一个是产生四元表达式 Codestatic int _t = 0; public string NewTemp() { ... 阅读全文
posted @ 2008-12-13 21:09 feathersky 阅读(1049) 评论(0) 推荐(0) 编辑
摘要: 代码分块一 属性不够可以自行补充 首先需要一个类来描述机甲单元 class MeshWarriorCell { int kind; //种类 int weight; //重量 int attack; //攻击 int recovery... 阅读全文
posted @ 2008-12-13 12:44 feathersky 阅读(362) 评论(0) 推荐(0) 编辑