Hi there i need some help,

i'm quite new to ANTLR and this is my first attempt. I'm trying to write a 
translator which converts files written in an so called operational language 
into java. 
Here a short example:

if (Demo1<> 0) and (Demo2<> 0) and (Demo3 <> 65535) and (Demo3 <> 0) then
        if (Demo3 >= 32768) then
                1.0 * Demo3 / Demo1 * Const1;
        else
                1.0 * Demo3 / Demo2 * Const2;
        endif;
else
        0;
endif;


should be converted to something like this:


public class Demo extends Synthetic {

        public Demo() {
                super();
        }

        protected boolean init() {
                String[] list = { "Demo1", "Demo2", "Demo3" };
                return setParametersNeeded(list);
        }

        protected void doComputation() {
                double Demo1= getValue("Demo1");
                double Demo2 = getValue("Demo2");
                double Demo3 = getValue("Demo3");
                double Const1 = Constants.Const1;
                double Const2 = Constants.Const2;

                if ((Demo1!= 0) && (Demo2 != 0) && (Demo3 != 65535)
                                && (Demo3 != 0)) {
                        if (Demo3 >= 32768) {
                                syntheticValue = Demo3 / Demo1* Const1;
                        } else {
                                syntheticValue = Demo3 / Demo2 * Const2;
                        }
                } else {
                        syntheticValue = 0;
                }
        }
}


So here are some of my questions :)
Is it possible to do this and how much effort will i probably take?
Where and how should i start? Are there any Examples or Samples of anything 
similar?


Cheers Stefan

--

You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=.


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to