Peter Nachtwey
Member
When it comes to compiler writing I am a newb. However, I am not like the major PLC manufacturers that have a piece of sh!t ST compiler just to say they have one. By now you should know I am a no compromise fanatic. I want to be best but I am almost starting from zero.
What I do know is that I should start with the public domain version of lex and yacc. The public domain version is flex and bison. These two programs require a lex and yacc files. The lex file specifies what the tokens are. Tokens are key words like if then, while , variables and operators.
Yacc or Bison generates a parse tree. Once you have the lex and yacc definition you are 90% of the way there. Once you have the lex and yacc file working then the last part is the code generator. There is one function called ex() that generates all the code and it is a big switch or case statement.
I will write more as I make more progress. I intend this thread to be kind of like a blog. So far I have been able to get some example programs going.
What I do know is that I should start with the public domain version of lex and yacc. The public domain version is flex and bison. These two programs require a lex and yacc files. The lex file specifies what the tokens are. Tokens are key words like if then, while , variables and operators.
Yacc or Bison generates a parse tree. Once you have the lex and yacc definition you are 90% of the way there. Once you have the lex and yacc file working then the last part is the code generator. There is one function called ex() that generates all the code and it is a big switch or case statement.
I will write more as I make more progress. I intend this thread to be kind of like a blog. So far I have been able to get some example programs going.