
James G. answered 06/24/19
Computer Science and Programming Tutor, Teacher, and Professional
I wrote part of a compiler in grad school. I teach Java and programmed in C at one time. I can tell you more in terms of Java in this response. Java is rich in data structures to enable the functionality that you need and I think that C++ or C# are comparable. Java has many advanced List functions for queues and stacks that you will need. Recursion is also a required feature and Java can do that too. You need to perform extensive string manipulation and there are enabling functions to do that in these languages. I would start small and grow the project. First you need to have the ability to create and store variables of different types, allocating memory and initializing the variables. Start with an integer for ease, then a double and a string after. Keep it simple at first. You will be searching the lines of code, as strings, for keywords like "int", "for", etc. You will need to go through two passes, storing the data in stacks and queues. There are some good books on Compiler creation written for university instruction. Mine is now old and obsolete but you can get one from Amazon easily enough, though it may be hard to follow unless you understand data structures and algorithms well. I hope that this helps a little. The web is full of good ideas on compiler writing in the different languages including how to write a simple compiler. You need a lot more than my brief answer.