# How to get the typed AST of a function's code?

**URL:** https://discourse.julialang.org/t/how-to-get-the-typed-ast-of-a-functions-code/3016
**Category:** New to Julia
**Tags:** question
**Created:** [April 3, 2017, 5:52am UTC](https://discourse.julialang.org/t/how-to-get-the-typed-ast-of-a-functions-code/3016 "2017-04-03T05:52:04Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jinliangwei](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jinliangwei/32/1929_2.png) [@jinliangwei](https://discourse.julialang.org/u/jinliangwei)
#### Post date: [April 3, 2017, 5:52am UTC](https://discourse.julialang.org/t/how-to-get-the-typed-ast-of-a-functions-code/3016/1 "2017-04-03T05:52:04Z")

</div>

The `LambdaInfo` object returned by `code_typed` contains a `code` field, but it seems to be a compressed byte array of type `Array{UInt8, 1}`. Is there any way to get the uncompressed code (hopefully typed) as an array of statements?

---

<div class="post-metadata">

### Author: ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)
#### Post date: [April 3, 2017, 7:40am UTC](https://discourse.julialang.org/t/how-to-get-the-typed-ast-of-a-functions-code/3016/2 "2017-04-03T07:40:26Z")

</div>

It’s not very well documented yet, but there is: [https://github.com/SimonDanisch/Sugar.jl](https://github.com/SimonDanisch/Sugar.jl)  
You might want to look into the runtest or [https://github.com/SimonDanisch/Transpiler.jl](https://github.com/SimonDanisch/Transpiler.jl), to see more of Sugar’s features!

---

<div class="post-metadata">

### Author: ![jinliangwei](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jinliangwei/32/1929_2.png) [@jinliangwei](https://discourse.julialang.org/u/jinliangwei)
#### Post date: [April 3, 2017, 5:24pm UTC](https://discourse.julialang.org/t/how-to-get-the-typed-ast-of-a-functions-code/3016/3 "2017-04-03T17:24:16Z")

</div>

Fantastic! Looks like this is exactly what I need. Thanks a lot!
