I am working on a school project on building a simple compiler. I have the I/O pretty much worked out as to reading in the file and then printing it back out to the screen and another file etc. Okay, now where I am running into a bit of a problem is Taking these tokens that I am reading in and then checking them to see if they meet a certain criteria (according to the grammar provided by the professor). So far what I have done is this:
This compiles and also works. I was wondering if there was a better way to optimize how I can get the tokens out to check them against my grammar requirements. Plus, im not sure on how to handle tokenizing of the * + = / symbols which will be part of the expression grammar. I basically tested this with a file I called a.txt which was basically written like this:
I had to throw the ; in there to let it know to make a new line. Please let me know what you think, and any suggestions on how to improve such a thing. The rest of the work that I have done, including the grammar and the output assembly language about my project can be found at
http://members.nbci.com/acidmaxx/Compiler/compiler_project.html Thanks
alot. Looking forward to hear your ideas
[This message has been edited by Kevin Luludis (edited March 01, 2001).]