X-Git-Url: https://scm.cri.ensmp.fr/git/Faustine.git/blobdiff_plain/7aa377f6b67020aa1dff235ebb100943375cac94..8e216a8d5f6b094308594009342e53ef122b8062:/interpretor/symbol.ml?ds=inline diff --git a/interpretor/symbol.ml b/interpretor/symbol.ml index 68f5d5f..4d58697 100644 --- a/interpretor/symbol.ml +++ b/interpretor/symbol.ml @@ -12,64 +12,75 @@ exception Symbol_error of string;; (* MACRO *) let delay_memory_length = 100000;; let rdtable_memory_length = 100000;; +let rwtable_memory_length = 100000;; let vectorize_memory_length = 1000;; -let dimension_of_symbol : symbol -> int * int = +let dictionary_of_symbol : symbol -> (int * int) * int * string = fun (s : symbol) -> match s with - |Add -> (2, 1) - |Sub -> (2, 1) - |Mul -> (2, 1) - |Div -> (2, 1) - |Pass -> (1, 1) - |Stop -> (1, 0) - |Mem -> (1, 1) - |Delay -> (2, 1) - |Floor -> (1, 1) - |Int -> (1, 1) - |Sin -> (1, 1) - |Cos -> (1, 1) - |Atan -> (1, 1) - |Atan2 -> (2, 1) - |Sqrt -> (1, 1) - |Rdtable -> (3, 1) - |Mod -> (2, 1) - |Vectorize -> (2, 1) - |Vconcat -> (2, 1) - |Vpick -> (2, 1) - |Serialize -> (1, 1) - |Larger -> (2, 1) - |Smaller -> (2, 1) - |Prefix -> (2, 1) - |Select2 -> (3, 1) - |Select3 -> (4, 1);; + |Add -> ((2, 1), 0, "Add") + |Sub -> ((2, 1), 0, "Sub") + |Mul -> ((2, 1), 0, "Mul") + |Div -> ((2, 1), 0, "Div") + |Power -> ((2, 1), 0, "Power") + |Pass -> ((1, 1), 0, "Pass") + |Stop -> ((1, 0), 0, "Stop") + |And -> ((2, 1), 0, "And") + |Or -> ((2, 1), 0, "Or") + |Xor -> ((2, 1), 0, "Xor") + |Mem -> ((1, 1), 0, "Mem") + |Delay -> ((2, 1), delay_memory_length, "Delay") + |Floor -> ((1, 1), 0, "Floor") + |Ceil -> ((1, 1), 0, "Ceil") + |Rint -> ((1, 1), 0, "Rint") + |Int -> ((1, 1), 0, "Int") + |Float -> ((1, 1), 0, "Float") + |Sin -> ((1, 1), 0, "Sin") + |Asin -> ((1, 1), 0, "Asin") + |Cos -> ((1, 1), 0, "Cos") + |Acos -> ((1, 1), 0, "Acos") + |Tan -> ((1, 1), 0, "Tan") + |Atan -> ((1, 1), 0, "Atan") + |Atan2 -> ((2, 1), 0, "Atan2") + |Exp -> ((1, 1), 0, "Exp") + |Sqrt -> ((1, 1), 0, "Sqrt") + |Ln -> ((1, 1), 0, "Ln") + |Lg -> ((1, 1), 0, "Lg") + |Abs -> ((1, 1), 0, "Abs") + |Mod -> ((2, 1), 0, "Mod") + |Fmod -> ((2, 1), 0, "Fmod") + |Remainder -> ((2, 1), 0, "Remainder") + |Vectorize -> ((2, 1), vectorize_memory_length, "Vectorize") + |Vconcat -> ((2, 1), 0, "Vconcat") + |Vpick -> ((2, 1), 0, "Vpick") + |Serialize -> ((1, 1), 0, "Serialize") + |Gt -> ((2, 1), 0, "Gt") + |Lt -> ((2, 1), 0, "Lt") + |Geq -> ((2, 1), 0, "Geq") + |Leq -> ((2, 1), 0, "Leq") + |Eq -> ((2, 1), 0, "Eq") + |Neq -> ((2, 1), 0, "Neq") + |Shl -> ((2, 1), 0, "shift_left") + |Shr -> ((2, 1), 0, "shift_right") + |Max -> ((2, 1), 0, "Max") + |Min -> ((2, 1), 0, "Min") + |Prefix -> ((2, 1), 0, "Prefix") + |Select2 -> ((3, 1), 0, "Select2") + |Select3 -> ((4, 1), 0, "Select3") + |Rdtable -> ((3, 1), rdtable_memory_length, "Rdtalbe") + |Rwtable -> ((5, 1), rwtable_memory_length, "Rwtable");; + +let dimension_of_symbol : symbol -> int * int = + fun (s : symbol) -> + match (dictionary_of_symbol s) with + | (dimension, delay, name) -> dimension;; let delay_of_symbol : symbol -> int = fun (s : symbol) -> - match s with - |Add -> 0 - |Sub -> 0 - |Mul -> 0 - |Div -> 0 - |Pass -> 0 - |Stop -> 0 - |Mem -> 1 - |Delay -> delay_memory_length - |Floor -> 0 - |Int -> 0 - |Sin -> 0 - |Cos -> 0 - |Atan -> 0 - |Atan2 -> 0 - |Sqrt -> 0 - |Rdtable -> rdtable_memory_length - |Mod -> 0 - |Larger -> 0 - |Smaller -> 0 - |Vectorize -> vectorize_memory_length - |Vconcat -> 0 - |Vpick -> 0 - |Serialize -> 0 - |Prefix -> 1 - |Select2 -> 0 - |Select3 -> 0;; + match (dictionary_of_symbol s) with + | (dimension, delay, name) -> delay;; + +let string_of_symbol : symbol -> string = + fun (s : symbol) -> + match (dictionary_of_symbol s) with + | (dimension, delay, name) -> name;;