Example:
The following Tiger program
let function fact(n : int) : int = if n < 1 then 1 else (n * fact(n - 1)) in printint(fact(10)) end
is represented in abstract syntax by:
Let([FunDecs([FunDec("fact",[FArg("n",Tp(Tid("int")))],Tp(Tid("int")), If(Lt(Var("n"),Int("1")),Int("1"),Seq([Times(Var("n"),Call( Var("fact"),[Minus(Var("n"),Int("1"))]))])))])],[Call( Var("printint"),[Call(Var("fact"),[Int("10")])])])
pp-aterm rewrites this ATerm to:
Let( [ FunDecs( [ FunDec( "fact" , [FArg("n", Tp(Tid("int")))] , Tp(Tid("int")) , If( Lt(Var("n"), Int("1")) , Int("1") , Seq( [ Times( Var("n") , Call( Var("fact") , [Minus(Var("n"), Int("1"))] ) ) ] ) ) ) ] ) ] , [ Call( Var("printint") , [Call(Var("fact"), [Int("10")])] ) ] )