Question: how dag is different from syntax tree?
Answer: An abstract syntax tree (AST) is the procedure's parse tree with the nodes for most non-terminal symbols removed. A directed acyclic graph (DAG) is an AST with a unique node for each value.