-
Notifications
You must be signed in to change notification settings - Fork 18
Partial Evaluator Parse Tree Structure
Rezky Arizaputra edited this page Apr 28, 2020
·
1 revision
Each unit of the parse tree can be simplified in the following manner to achieve overall simplification and standardization of the parse tree.
- 0 + exp = exp + 0 = exp
- number + number = sum
- non-number + number = number + non-number
- math + variable = variable + math
- non-number + (number + exp) = number + (non-number + exp)
- math + (variable + exp) = variable + (math + exp)
- number + (number + exp) = sum + exp
- (exp + exp2) + exp3 = exp + (exp2 + exp3)
- exp3 + (exp / exp2) = exp + (exp2 + exp3)
- exp3 + (number +-* exp2) = number +-* (exp2 + exp3)
- mergable_terms + mergeable_terms = mergeable_terms_sum
- longer_list_terms + shorter_list_terms = shorter_list_terms + longer_list_terms
- starting_with_later_parameter_terms * starting_with_earlier_parameter_terms = starting_with_earlier_parameter_terms * starting_with_later_parameter_terms
- mergable_terms + (mergeable_terms + exp) = mergeable_terms_sum + exp
- longer_list_terms + (shorter_list_terms + exp) = shorter_list_terms + longer_list_terms
- starting_with_later_parameter_terms * (starting_with_earlier_parameter_terms + exp) = starting_with_earlier_parameter_terms * (starting_with_later_parameter_terms + exp)
- exp - exp2 = exp + (-1 * exp2)
- exp * (exp1 + exp2) = (exp1 + exp2) * exp = (exp * exp1) + (exp * exp2)
- 1 * exp = exp
- exp * 0 = 0 * exp = 0
- number * number = product
- exp * (1 / exp) = 1
- exp * ((1 / exp) * exp2) = exp2
- number * (number * exp) = product * exp
- math * non_math = non_math * math
- later_parameter_terms * earlier_parameter_terms = earlier_parameter_terms * later_parameter_terms
- exp * (exp2 / exp3) = (exp2 / exp3) * exp
- (exp * exp2) * exp3 = exp * (exp2 * exp3)
- exp *(number * exp4) = number * (exp4 * exp)
- variable * ((exp2 / exp3) * exp4) = (exp2 / exp3) * (exp4 * variable)
- later_parameter_terms * (earlier_parameter_terms * exp) = earlier_parameter_terms * (later_parameter_terms * exp)
- (exp / exp2) * (exp3 / exp4) = (exp * exp3) / (exp2 * exp4)
- (exp / exp2) * ((exp3 / exp4) * exp5) = ((exp * exp3) * (exp2 * exp4)) * exp5
- exp * exp2
- exp / 1 = exp
- exp / exp = 1
- 1 / ((1 / exp) * exp2) = 1 / (exp2 * (1 / exp)) = exp / exp2
- 1 / exp
- exp / (exp1 / exp2) = (exp2 / exp1) * exp
- (exp === exp) = true
- (exp <= exp) = true
- (exp >= exp) = true
- (exp !== exp) = false
- (exp < exp) = false
- (exp > exp) = false