|
The main reason I wrote the program in C as opposed to C++ is the fact that the tools I used (Bison and Flex) output C code. They also happen to be fairly standard tools on Unix (going by the names Yacc and Lex). Flex is a tokenizer. It allows you to specify regular-expressions and the Flex command will take your input file (in emulationFIRST the file is pbasic.l) and create a tokenizer that you can call. Bison is a program that allows you to specify certain patterns of tokens and takes your input file (in emulationFIRST the file is pbasic.y) and outputs a C file. This C file is based around a state machine. Overall, the combination of Bison and Flex works wonders as it made a lot of the actually parsing much much easier.
The other reason that C was used over C++ is that I tend to prefer C a bit. For what was needed, C++ seemed like it would be overkill.
As far as a GUI goes, I've already written the program to separate the input from the actual processing. You can look at the file console.c (it runs the UI right now) and you can see that the parser never calls any function in console.c (except by using call-backs/function pointers). I'm planning to base my GUI on GTK 2.0 which was originally native for Linux but also has a Windows port (and may have a Mac port, I'm not sure). GTK is written in C so it makes it easier to interface with other C code.
If you have any questions or whatnot, please feel free to contact me.
Matt
|