0

I am currently working on a project that requires me creating a Domain specific language to allow end user customize our application. we are trying to keep it as simple as possible.

I started a research that lead me to the Antlr v3 tool which works well with java. I have a been able to parse arithmetic expressions and String operations and a few built in functions.

However owing to limited details in tutorials seen online I have been having challenges implementing my defined grammar rule for both if statements and loop as i do not understand aw am suppose to ensure that the expressions in this control statements are only executed when the appropriate conditions are met.

I will appreciate anyone who can share his/her implementation of control statements or point me to a tutorial that goes beyond defining the grammar rules (as i have been able to create a grammar construct) and shows how to ascertain conditions are met before executing a statement (what i require is a java program that implements the construct to execute only wen the condition is true ).

jaysman
  • 51
  • 5
  • I'd advise adding an example of the syntax you're tring to implement, so we can analyse it better. – Haroldo_OK Sep 21 '15 at 12:01
  • 1
    Have you seen http://stackoverflow.com/questions/15610183/if-else-statements-in-antlr-using-listeners? – tom Sep 21 '15 at 12:07
  • 1
    The *syntax* for the control flow constructs is something that can be described in an ANTLR grammar. The *semantics* of these control flow constructs (how to ensure that the included statements are executed only if the conditions are met) is not related to ANTLR or the grammar. Which of these two are you actually having a problem with? Are you writing an interpreter or a compiler? – Theodoros Chatzigiannakis Sep 21 '15 at 12:19
  • @Barts Kiers thanks for timely response but that post is perculiar to antlr v4 and am using v3, and perhaps if am not mistaken maybe what I need is the listener tutorial for java. – jaysman Sep 21 '15 at 13:23
  • @Theodoros Chatzigiannakis thanks but what i really want is how semantics that is i do av a construct defined in my grammar what i am trying to obtain is information how execute only if conditions are met, and I am work on an Interpreter if it makes any difference. – jaysman Sep 21 '15 at 13:29
  • @Haroldo_ok, thanks for timely response, the reason there is no code attached to my question is because am not having an issue with what have written so far, what in need is ideas on how to extend what i have already done – jaysman Sep 21 '15 at 13:41

0 Answers0