Skip to content

Grammar

Grammar

The following excerpt shows the grammar of ITL. For interpreting entered syntax by this definition, Lark parser was used.

start: instruction+

instruction: "assessment" STRING code_block -> pocetak_izvestaja
           | "metrics" NAME "{" dict_item* "}" -> skup_metrika
           | "grade" NAME ";" -> oceni_metrike
           | "grade cumulative" NAME "," NAME ("," NAME)* ";" -> oceni_metrike_z
           | "grade comparative" NAME "," NAME";" -> oceni_metrike_u
           | "grade singular" NAME ("," NAME)* ";" -> oceni_metrike_p
           | "print" NAME ("," NAME)* ";" -> ispisi_metrike
           | "make excel report" STRING ";" -> pravi_izvestaj
           | "draw metric" NAME ("," NAME)* "from" set -> nacrtaj_metriku

code_block: "{" instruction+ "}" -> blok_naredbi
dict_item: NAME "=" dict_subitem -> naziv_metrike
dict_subitem: "(" NUMBER "," NUMBER "," NUMBER ")" -> par_mer_lin     
            | "trapezoid(" STRING? ","? NUMBER "," NUMBER "," NUMBER "," NUMBER "," NUMBER ")" -> par_mer_tra
            | "triangle(" STRING? ","? NUMBER "," NUMBER "," NUMBER "," NUMBER ")" -> par_mer_tri
            | "gauss(" STRING? ","? NUMBER "," NUMBER "," NUMBER ")" -> par_mer_gau
            | "gauss2(" STRING? ","? NUMBER "," NUMBER "," NUMBER "," NUMBER "," NUMBER ")" -> par_mer_gau2
            | "sigmoid(" STRING? ","? NUMBER "," NUMBER "," NUMBER ")" -> par_mer_sig
set: NAME ";" -> from
COMMENT : /#.*/

%import common.CNAME -> NAME
%import common.NUMBER -> NUMBER
%import common.ESCAPED_STRING -> STRING
%import common.WS
%ignore WS
%ignore COMMENT