1%The grammar files are saved in grammars.pl
    2
    3statement_with_semicolon(Data,Return_type,return(To_return)) -->
    4	return_(Data,[
    5		expr(Data,Return_type,To_return)
    6	]).
    7	
    8statement_with_semicolon(Data,_,plus_plus(Name)) --> 
    9        plus_plus_(Data,[
   10			var_name_(Data,int,Name)
   11        ]),!.
   12
   13statement_with_semicolon(Data,_,minus_minus(Name)) --> 
   14	minus_minus_(Data,[var_name_(Data,int,Name)]),!.
   15
   16statement_with_semicolon(Data,_,initialize_constant(Type,Name,Expr)) -->
   17	initialize_constant_(Data,[
   18		var_name_(Data,Type,Name),
   19		type(Data,Type),
   20		expr(Data,Type,Expr)
   21	]).
   22
   23
   24statement_with_semicolon(Data,_,set_array_size(Name,Size,Type)) -->
   25	set_array_size_(Data,[
   26		var_name_(Data,Name,[array,Type]),
   27		expr(Data,int,Size),
   28		type(Data,Type)
   29	]).
   30
   31statement_with_semicolon(Data,_,set_dict(Name,Index,Expr,Type)) -->
   32	set_dict_(Data,[
   33		var_name_(Data,[dict,Type],Name),
   34		parentheses_expr(Data,string,Index),
   35		expr(Data,Type,Expr)
   36	]).
   37statement_with_semicolon(Data,_,set_array_index(Name,Index,Expr,Type)) -->
   38	set_array_index_(Data,[
   39		var_name_(Data,[array,Type],Name),
   40		parentheses_expr(Data,int,Index),
   41		parentheses_expr(Data,Type,Expr)
   42	]).
   43
   44
   45statement_with_semicolon(Data,_,set_var(Name,Expr,Type)) -->
   46	set_var_(Data,[
   47		var_name_(Data,Type,Name),
   48		expr(Data,Type,Expr)
   49	]).
   50	
   51statement_with_semicolon(Data,_,set_instance_var(Name,Expr,Type)) -->
   52	set_var_(Data,[
   53		expr(Data,Type,this(Name)),
   54		expr(Data,Type,Expr)
   55	]).	
   56
   57statement_with_semicolon(Data,_,initialize_empty_var(Type,Name)) -->
   58	initialize_empty_var_(Data,[
   59		var_name_(Data,Type,Name),
   60		type(Data,Type)
   61	]).
   62
   63statement_with_semicolon(Data,_,throw(Expr)) -->
   64	throw_(Data,expr(Data,string,Expr)).
   65
   66statement_with_semicolon(Data,_,initialize_var(Name,Expr,Type)) -->
   67	initialize_var_(Data,[
   68		var_name_(Data,Type,Name),
   69		expr(Data,Type,Expr),
   70		type(Data,Type)
   71	]).
   72
   73statement_with_semicolon(Data,_,append_to_array(Name,Expr,Type)) -->
   74        append_to_array_(Data,[
   75			var_name_(Data,[array,Type],Name),
   76            expr(Data,Type,Expr)
   77        ]).
   78
   79statement_with_semicolon(Data,_,reverse_list_in_place(List,Type)) -->
   80	reverse_list_in_place_(Data,[
   81		parentheses_expr(Data,[array,Type],List)
   82	]).
   83
   84
   85statement_with_semicolon(Data,_,plus_equals(Name,Expr)) -->
   86		plus_equals_(Data,[
   87			var_name_(Data,int,Name),
   88            expr(Data,int,Expr)
   89		]).
   90
   91statement_with_semicolon(Data,_,divide_equals(Name,Expr)) -->
   92		divide_equals_(Data,[
   93			var_name_(Data,int,Name),
   94            expr(Data,int,Expr)
   95		]).
   96
   97statement_with_semicolon(Data,_,exponent_equals(Name,Expr)) -->
   98		exponent_equals_(Data,[
   99			var_name_(Data,int,Name),
  100            expr(Data,int,Expr)
  101		]).
  102
  103statement_with_semicolon(Data,_,modulo_equals(Name,Expr)) -->
  104		modulo_equals_(Data,[
  105			var_name_(Data,int,Name),
  106            expr(Data,int,Expr)
  107		]).
  108
  109statement_with_semicolon(Data,_,array_plus_equals(Name,Expr,Type)) -->
  110		array_plus_equals_(Data,[
  111			var_name_(Data,[array,Type],Name),
  112            expr(Data,[array,Type],Expr)
  113		]).
  114
  115statement_with_semicolon(Data,_,dict_plus_equals(Name,Expr,Type)) -->
  116		dict_plus_equals_(Data,[
  117			var_name_(Data,[dict,Type],Name),
  118            expr(Data,[dict,Type],Expr)
  119		]).
  120
  121statement_with_semicolon(Data,_,string_plus_equals(Name,Expr)) -->
  122		string_plus_equals_(Data,[
  123			var_name_(Data,string,Name),
  124            expr(Data,string,Expr)
  125		]).
  126
  127statement_with_semicolon(Data,_,minus_equals(Name,Expr)) -->
  128	minus_equals_(Data,[
  129		var_name_(Data,int,Name),
  130		expr(Data,int,Expr)
  131	]).
  132statement_with_semicolon(Data,_,append_to_string(Name,Expr)) -->
  133	append_to_string_(Data,[
  134		var_name_(Data,string,Name),
  135		expr(Data,string,Expr)
  136	]).
  137
  138
  139
  140statement_with_semicolon(Data,_,shuffle_array(List,Type)) -->
  141	shuffle_array_(Data,[
  142		parentheses_expr(Data,[array,Type],List)
  143	]).
  144
  145statement_with_semicolon(Data,_,get_user_input_with_prompt(Var,Prompt)) -->
  146	get_user_input_with_prompt_(Data,[
  147		var_name_(Data,string,Var),
  148		expr(Data,string,Prompt)
  149	]).
  150
  151statement_with_semicolon(Data,_,times_equals(Name,Expr)) -->
  152	times_equals_(Data,[
  153		var_name_(Data,int,Name),
  154		expr(Data,int,Expr)
  155	]).
  156
  157statement_with_semicolon(Data,_,assert(Expr)) -->
  158        assert_(Data,[expr(Data,bool,Expr)]).
  159
  160
  161statement_with_semicolon(Data,Type,println(Expr,Type)) -->
  162        println_(Data,[
  163			expr(Data,Type,Expr),
  164			Type
  165		]).
  166
  167statement_with_semicolon(Data,Type, function_call(Name,Params1,Params2)) -->
  168    function_call_(Data,[
  169		function_name(Data,Type,Name,Params2),
  170		function_call_parameters(Data,Params1,Params2)
  171	])