BrainFuck解释器
无注释版本:
#include <stdio.h> #include <stdlib.h> #define SIZE 5000 char data[SIZE], code[SIZE]; int ptr, flag; void interpreter(char *ip) { char* re; while (*ip) { switch(*ip++) { case '<': --ptr; break; case '>': ++ptr; break; case '+': ++data[ptr]; break; case '-': --data[ptr]; break; case '.': putchar(data[ptr]); fflush(stdout); break; case ',': data[ptr] = getchar(); fflush(stdout); break; case '[': for (flag=1,re=ip; flag && *ip; ++ip) flag += *ip=='[', flag -= *ip==']'; if(!flag) { ip[-1] = 0; while (data[ptr]) interpreter(re); ip[-1] = ']'; break; } case ']': puts("Unbalancded brackets!"), exit(-3); default : ;//SKIP } if (ptr < 0 || ptr > 100) puts("Out of Range"), exit(-4); } } int main(int argc, char *argv[]) { FILE *fin; int codelength; if (argc != 2) return puts("BrainFuck Interpreter v 0.1\nStar\nUsage:BFI filename"), 0; if ((fin = fopen(argv[1], "r")) == NULL) return puts("Cannot open file!"), -1; fseek(fin, 0, SEEK_END); if ((codelength = ftell(fin)) > SIZE) return puts("The program is too large."), -2; fseek(fin, 0, SEEK_SET); fread(code, codelength, 1, fin); code[codelength] = '\0'; interpreter(code); return 0; }
2019年4月02日 14:46
For the job and the post of the interpreter with the logically have to unique parts about the mind need more stuck. With the last job have made my mind mental and on the bestessays.com.au reviews website I have got the interpreter job with the only translations.
2019年6月01日 17:54
Your site has a lot of useful information for myself. I visit regularly. Hope to have more quality items.
2020年3月20日 22:15
Any time you are exploring the net at times I find a web site that can be quite thought invoking like this one. I want to express that I discovered the info within your site has been especially entertaining and that I learned something new. We're certain to watch out for the following post.. Thank you for this fantastic post I am going to return in the future. buy turkey phone number
2020年4月18日 04:17
It is somewhat fantastic, and yet check out the advice at this treat. 바카라사이트
2020年4月24日 22:48
I invite you to the page where see how much we have in common. 먹튀폴리스
2020年4月27日 01:01
On this page, you'll see my profile, please read this information. 남성수술
2020年5月02日 02:46
It is very good, but look at the information at this address. daftar nova88
2020年5月06日 01:22
Through this post, I know that your good knowledge in playing with all the pieces was very helpful. I notify that this is the first place where I find issues I've been searching for. You have a clever yet attractive way of writing. sagame
2020年5月07日 22:53
I wrote about a similar issue, I give you the link to my site. เซ็กซี่ บาคาร่า
2020年7月07日 00:18
Listed here you'll learn it is important, them offers the link in an helpful webpage: residential garage doors centereach ny
2020年7月08日 21:08
Listed here you'll learn it is important, them offers the link in an helpful webpage: best seo companies Sydney
2020年7月12日 02:16
This is very appealing, however , it is very important that will mouse click on the connection: party
2020年7月18日 04:41
It is fine, nonetheless evaluate the information and facts around this correct. smm panel
2020年8月16日 22:43
These websites are really needed, you can learn a lot.
2020年12月18日 18:24
Acknowledges for penmanship such a worthy column, I stumbled beside your blog besides predict a handful advise. I want your tone of manuscript...
2020年12月20日 23:04
It is somewhat fantastic, and yet check out the advice at this treat. Cheap Marketing Consultant
2021年3月23日 03:25
Hi there, I discovered your blog per Google bit searching for such kinda educational advise moreover your inform beholds very remarkable for me.
2022年7月10日 14:48
Jharkhand 1st, 2nd, 3rd, 4th, 5th English, Hindi, Mathematics, EVS, Various Textbook 2023 Provide in School Wise Free Distribution in Government School, Jharkhand Primary School Various ClassJSCRT 4th Class Textbook ts Best idea Students Method Jharkhand Board has Adopted the NCERT Textbook and Syllabus for Elementary School Education in the State. Therefore Jharkhand Board 1st, 2nd, 3rd, 4th, 5th Textbooks 2023 Include All the topics Prescribed by the State Council of Educational Research and Training (SCERT) Jharkhand.
2023年1月29日 21:53
State Bank of India is one of the largest Indian banking services which is also spread widely across the country and in foreign nations as well. And it is a great decision if you have already opened up your banking account SBI Net Banking with the SBI because you will understand and get more benefits that you can avail of through their online banking service through online and from their Yono app as well to use SBI credit card and debit card services too.