<commit_before>open Semantics

let c_statement (x,y,z) g ti li = match x with
		Int(v) 	-> 	print_endline ("int t" ^ string_of_int !ti ^ " = " ^ string_of_int v); 
		ti := !ti + 1; 
		()
	| 	Flt(v) 	-> 	print_endline ("int t" ^ string_of_int !ti ^ " = " ^ string_of_float v); 
					ti := !ti + 1;
					()
	|	Add_Op	-> 	()
	|	Id(v)	-> 	()				
	|	Asn_Op	->  ()
	| 	_ 		->	()	




let generate_c lst g ti li = List.iter (fun (x) -> c_statement x g ti li) lst; ()<commit_msg>Flatc working for some operators (add, vec2)<commit_after>open Semantics
open Stack

let stck = Stack.create ()
let a = Stack.push (0) stck
let a = Stack.pop stck

let c_statement (x, y, z) g ti li = match x with		
		Int(v) 	-> 	print_endline ("int t" ^ string_of_int !ti ^ " = " ^ string_of_int v ^ ";"); 
					ti := !ti + 1; 
					Stack.push (!ti - 1) stck
	| 	Flt(v) 	-> 	print_endline ("int t" ^ string_of_int !ti ^ " = " ^ string_of_float v ^ ";"); 
					ti := !ti + 1;
					Stack.push (!ti - 1) stck
	|	Add_Op	-> 	let i1 = Stack.pop stck and i2 = Stack.pop stck in
					print_endline ("int t" ^ string_of_int !ti ^ " = t" ^ string_of_int i1 ^ " + t" ^ string_of_int i2 ^ ";"); 
					ti := !ti + 1;
					Stack.push (!ti - 1) stck
	|	Vec2_Op	-> 	let i1 = Stack.pop stck and i2 = Stack.pop stck in
					(* need to get exact c++ syntax for vec2 *)
					print_endline ("vec2 t" ^ string_of_int !ti ^ " = t" ^ string_of_int i2 ^ ", t" ^ string_of_int i1 ^ ";"); 
					ti := !ti + 1;
					Stack.push (!ti - 1) stck
	|	Id(v)	-> 	()				
	|	Asn_Op	->  ()
	| 	_ 		->	()	




let generate_c lst g ti li = List.iter (fun (x) -> c_statement x g ti li) lst; ()
{'fraction_non_alphanumeric': 0.17262638717632553, 'fraction_numerical': 0.014180024660912454, 'mean_word_length': 2.367219917012448, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3641947', 'n_tokens_mistral': 800, 'n_tokens_neox': 713, 'n_words': 195}