- Bindings and IdentSet
- Equivalence classes
-
AST Transformation Utilities
- Calculating free variables of expressions and types
- Calculating assigned variables in statements
- Collect local bindings (variables and constants)
- Calculate types used in expressions and statements
- Calculate functions and procedures called in statements
- Substitutions
- Expression transformation
- Resugaring
- Pretty printing wrappers
- Misc
package asli
Module LibASL.Asl_utilsSource
ASL utility functions
Bindings and IdentSet
add association list to bindings
create bindings from association list
print bindings
merge a list of sets
val addToBindingSet :
AST.ident ->
AST.ident ->
IdentSet.t Bindings.t ->
IdentSet.t Bindings.tadd v to set of identifiers mapped to k
convert identifier set to sorted list of identifiers
The implementation is trivial and exists mostly to emphasize that the resulting list is sorted
Equivalence classes
Equivalence classes are represented by trees.
The root of the tree is the canonical member of the class. Traversing the parent node takes you closer to the canonical member. The root is its own parent.
Equivalence class support (to support unification, and similar)
The implementation is based on Wikipedia: Union-Find. I have not implemented all the optimizations they suggest because I expect sets to be quite small in practice.
AST Transformation Utilities
Calculating free variables of expressions and types
Calculating assigned variables in statements
Collect local bindings (variables and constants)
Calculate types used in expressions and statements
Calculate functions and procedures called in statements
Substitutions
Performing variable substitutions in expressions and types
More flexible substitution class - takes a function instead of a binding set.
Expression transformation
Expression transformation class
Resugaring
Resugaring transform
Pretty printing wrappers
Misc
Length of bitstring or mask literal.
ASL bit and mask literals allow spaces to be included - these do not count towards the length of the literal.
- Bindings and IdentSet
- Equivalence classes
-
AST Transformation Utilities
- Calculating free variables of expressions and types
- Calculating assigned variables in statements
- Collect local bindings (variables and constants)
- Calculate types used in expressions and statements
- Calculate functions and procedures called in statements
- Substitutions
- Expression transformation
- Resugaring
- Pretty printing wrappers
- Misc