1. A method for translating a first program in a dynamically-typed language to a second program in a hardware description language, comprising: generating a control flow graph of the first program, the graph having nodes that represent blocks of code and edges that represent control flow between the blocks of code; generating a static single assignment (SSA) program from the first program and the control flow graph, wherein assignments of φ( ) functions to respective renamed variables are inserted at blocks of code that correspond to join points in the graph, and each φ( ) function is specified with input arguments corresponding to type-defining occurrences of a variable that is visible at the join point; wherein each input argument in at least one φ( ) function corresponds to a different data type assigned to the variable; resolving type differences between arguments to the φ( ) functions; wherein resolving comprises for each variable having assignments of different data types, defining a renamed variable to be of a composite data type that is sufficient for storage of each of the different data types; inserting, for each φ( ) function, assignment statements in the blocks of code that correspond to nodes leading to the join points in the graph, and removing each φ( ) function from the SSA program, each assignment statement being an assignment of a type-defining occurrence of a variable, in the block of code that corresponds to the node leading to a join point, to a renamed variable; and translating the SSA program to the second program in the hardware description language.