hello,
Iv recently been working on a compiler, so far i have a fairly decent working lexical analyzer and token scanner. So i can break down the code into a series of tokens and analyze them for correct strucutre.
I also understand how to generate x86 instructions. However im lost somewhere in between linking these two. The book i have describes the first and last step but seems to omit how i get from:
Have a series of tokens that are correct eg :
import java.whatever;
Keyword | package Name | seperator | class name | seperator
It does not explain how i go from having a series of tokens that are known to be in the correct structure of the language to outputing binary or even assembly language from these tokens. Must i scan through the tokens again and generate binary or an assembly statement for each line? Or should it be implemented in a higher level of abstraction and add to the total value's of an executeable class?
I know its kind of a broad question, but any help on the general logic and filling the gap between correct tokens to outputing binary would be good :) its not something im grasping from the book.