I am trying to extend an existing language which only has basic data types (int, float etc.) to support complex data types (similar to struct in C). I was planning to execute the implementation in the following manner.
1. Write the grammer --- Done 2. Write a null translator whose output will be the same as the input --- Using the article at " http://www.antlr.org/article/whitespace/index.html Preserving whitespace during translation" for reference This was written for antler 2.x and does not work with antlr 3.x. Also the files referenced in the article are no longer distributed with antlr3. Can anyone help me by pointing an equivalent reference that works with antlr3.... 3. Perform a first pass over the code to identify all struct definitions and populate a list with the same. 4. Perform a second pass to replace all struct variable declaration's and assignments with the normal data types. Is my approach correct? Is there a better way? e.g. consider struct { int a, //declare a float b //declare b } xyz; xyz foo,bar; //two vars foo.a=bar.a; //assignment foo=bar;//another variation f(bar); I am planning to translate this to //two vars int foo_a; //declare a float foo_b; //declare b //two vars int bar_a; //declare a int bar_b; //declare b foo_a=bar_a; //assignment foo_a=bar_a;// another variation a foo_b=bar_b; // another variation b f(bar_a,bar_b) Regards Vijay List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- 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=en.
