|
写了个脚本解释器
完善了下,把内存泄漏清理了,支持数组和for 测试代码: main() { n1=12; num ss[5000]; fg=0; t1=time(); ss[0]=2; ss[1]=3; ss[2]=5; ss[3]=7; ss[4]=11; n3=4; while (n1<=5000) { for (n2=0;n2<=n3;n2++) { if (n1<ss[n2]*ss[n2]) break; if (n1 % ss[n2]==0) {fg=0;break;} else fg=1; } if (fg==1) {n3++;ss[n3]=n1;fg=0;} n1++; } t2=time(); print("time="+(t2-t1)); print("0-5000 prime number has "+(n3+1)+":"); for(i=0;i<=n3;i++)print(ss[i]); } 计算0-5000的素数,这个代码是照kflnig的改的 http://bbs.pediy.com/showthread.php?s=&threadid=40052 不过速度慢了点,比直接运行大约慢了4000倍 |
|
写了个脚本解释器
最初由 sbright 发布 这个是写了玩的,就支持两个内建函数,sin和print,另外还有一堆BUG和内存泄漏 |
|
写了个脚本解释器
改了下,可以支持函数了 测试代码: n=3; f2(a,b,c){print(a);print(b);print(c);} f1(a) { print("f1 a="+a); if(!n) { f2("pa","pb","pc"); return a; } a=a+1; n--; f1(a); return a; } main() { print("f1 return "+f1(3)); n=6; while(n--) { print("main n="+n); if(n==3)return 1; } print("end"); } |
|
[求助]lex&yacc:如何纯解释执行分支循环语句??
谢谢,这个问题解决了 if是通过设置一个全局skip变量解决,所有的expression都首先判断skip,若不位零则不执行语义 while可以改变lex的文本缓冲区指针解决,不过这一方法要用到lex.cpp中非文档化的变量,可能只使用于特定版本,并且文本输入只能是内存缓冲区模式不能是FILE*yyin模式,因为FILE模式时只是部分文本在内存中 改变文本缓冲区的函数: int resetloop(char*text) { *yy_c_buf_p=yy_hold_char; yy_c_buf_p=text; yy_hold_char=*text; return 1; } char*text可由yytext获得,yytext正是"while"的首地址,且yytext就指向文本缓冲区内,yy_hold_char是yytext末尾的"\0"原先的字符,这是为了直接在文本缓冲区中形成yytext "while" {yylval.state=(int)yytext;return WHILE;} |
|
[讨论]StarForce破解的思路!
最初由 softbihu 发布 VMopcode--->int1--->updateVM--->iret--->VMopcode--->int1--->updateVM... |--3ring---|-------0ring-----------|-----3ring-----|----0ring----.... 就是说把updateVM部分在3ring模拟后运行还会遇到另一个INT1 |
|
[讨论]StarForce破解的思路!
最初由 脱壳请教 发布 高手,我知道到你是谁了 VM应该怎么猜呢?能否给些提示? 这样行不行:过VMcall之前和之后保存所有内存然后对比 不过这样好象也只适用于只call一次的VM,那些call多次的参数不同的就不行了 INT1好象可以在3RING模拟,INT1就是在0RING下更新VM状态,只要模拟更新VM REM应该就可以了 我模拟了一个INT1,不过接着运行下去又是一个INT1,无穷无尽 |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值