<commit_before>signature ENV =
sig
	type access
	type ty

	datatype enventry = VarEntry of {ty: ty}
	                  | FunEntry of {formals: ty list, result: ty}
	val base_tenv : ty Symbol.table
	val base_venv : enventry Symbol.table
end

structure Env :> ENV = 
struct
	structure S = Symbol
	structure T = Types

	(* Dunno what's this yet *)
	type access = unit

	type ty = T.ty

	datatype enventry = VarEntry of {ty: ty}
	                  | FunEntry of {formals: ty list, result: ty}

	val predef_types = [("int", T.INT), ("string", T.STRING)]

	fun fillTypeFn ((name, ty), ans) = S.enter(ans, S.symbol name, ty)
	val base_tenv = foldl fillTypeFn S.empty predef_types

	val predef_funcs = [("print", FunEntry {formals=[T.STRING], result=T.UNIT})]

	fun fillFuncFn ((name, entry), ans) = S.enter(ans, S.symbol name, entry)
	val base_venv = foldl fillFuncFn S.empty predef_funcs
end<commit_msg>added more functions to env.sml<commit_after>signature ENV =
sig
	type access
	type ty

	datatype enventry = VarEntry of {ty: ty}
	                  | FunEntry of {formals: ty list, result: ty}
	val base_tenv : ty Symbol.table
	val base_venv : enventry Symbol.table
end

structure Env :> ENV = 
struct
	structure S = Symbol
	structure T = Types

	(* Dunno what's this yet *)
	type access = unit

	type ty = T.ty

	datatype enventry = VarEntry of {ty: ty}
	                  | FunEntry of {formals: ty list, result: ty}

	val predef_types = [("int", T.INT), ("string", T.STRING)]

	fun fillTypeFn ((name, ty), ans) = S.enter(ans, S.symbol name, ty)
	val base_tenv = foldl fillTypeFn S.empty predef_types

	val predef_funcs = [("print", 		FunEntry {formals=[T.STRING], result=T.UNIT}),
						("flush", 		FunEntry {formals=[], result=T.UNIT}),
						("getchar", 	FunEntry {formals=[], result=T.STRING}),
						("ord", 		FunEntry {formals=[T.STRING], result=T.INT}),
						("chr", 		FunEntry {formals=[T.INT], result=T.STRING}),
						("size",		FunEntry {formals=[T.STRING], result=T.INT}),
						("substring",	FunEntry {formals=[T.STRING,T.INT,T.INT], result=T.STRING}),
						("concat",		FunEntry {formals=[T.STRING,T.STRING], result=T.STRING}),
						("not",			FunEntry {formals=[T.INT], result=T.INT}),
						("exit",		FunEntry {formals=[T.INT], result=T.UNIT})]

	fun fillFuncFn ((name, entry), ans) = S.enter(ans, S.symbol name, entry)
	val base_venv = foldl fillFuncFn S.empty predef_funcs
end
{'fraction_non_alphanumeric': 0.14100486223662884, 'fraction_numerical': 0.0, 'mean_word_length': 3.0475409836065572, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4348221', 'n_tokens_mistral': 986, 'n_tokens_neox': 856, 'n_words': 249}