My question is what I will need learn to complete that task ...the task is to create automatic code generator from simple programming instructions like
(x:=5-z; while x<z do (x:=x*2; z:=z+x) )
and translate it to ABSTRACT MACHINE INSTUCTIONS ..
PUSH-5:FETCH-z:SUB:STORE-x: LOOP ...etc....
so my question is...Where to start?? , I will need some parser and the parser have to work with some XML ..but I really donĀ“t know how to define XML ..
please help where to start ..thanks ..
I will code it in JAVA swing UI
it's not so hard to implement your own parser if you know the syntax you support. Parse the string char by char, detect operators, literal terminations or variable name endings by next operator or blank, and get the previously stored characters as token. Identify the kind of token, and build your object oriented model in Java. As soon as you have an object oriented model of your expression, you can use e.g. the Visitor pattern to PRETTY-PRINT, EVALUATE or even TRANSLATE TO MACHINE CODE, depending on your visitor implementations.
(Out of perspective: from your question, it's not clear how this parser has to deal with XML...)
Years ago I implemented such a parser that evaluates such expressions (but not yet converts to machine code). My old project could give you an idea how I solved this task.