Reconstruction of AST struct into algebra (needed for testing).