Without watching any tutorials to guide me or reading anything, prior to posting this thread I have made a little code stub in java that can read files and successfully breaks them down into tokens, I can imagine how I would expand it to create a calculator that understands operations and can set values to variables. I would find anywhere that there's an equals sign and declare the line of code ended by a semi-colon (my choice) as a variable setting, I would have a hashmap with string and integer types (if my programming language were to accept only integers as variable values), the string would be the variable name. If a hashmap contained a variable that I was setting a value to, I would just update the value, otherwise create a new entry with the new value. If a line of code didn't have an equals sign I could just print the value either from the variable in the hashmap if it's a variable name or the numeric or string value if it wasn't, if it was a variable that doesn't exist in the hashmap I'd just throw an exception.
If it helps you understand my understanding of parsing I can give you the stub of code that breaks down a file into tokens, or I can see if I can complete the calculator if you deem it necessary so you could give me better advice. I haven't started thinking about how I could create classes, instances or methods though I'd imagine all values that would exist would be a class with a hashmap of <String (vaiable name), Itself>.
Edit: How would I add generics to my programming language if my programming language's parser written in java, which, doesn't allow storing generics?
Edited by Kreative, 30 October 2015 - 05:45 AM.