[CakeML-dev] compiler explorer

Magnus Myreen magnus.myreen at gmail.com
Fri Jun 30 06:50:37 UTC 2017

On 30 June 2017 at 08:39, Ramana Kumar <Ramana.Kumar at cl.cam.ac.uk> wrote:
> The compiler explorer seems to have been written prior to some changes to
> the locations type. Looking at this line in particular, I notice that the
> offset field of the locn record is not used. Is this correct?
>   (compile_exp t env (Lannot e (Locs st en)) =
>     let t' = if t = None then t else (Cons (Cons (Cons (Cons Empty st.row)
> st.col) en.row) en.col) in
>       compile_exp t' env e)
> for reference:
> val _ = Datatype `
>  locn = <| row : num;  col : num; offset : num |>`;
> val _ = Datatype `
>   locs = Locs locn locn
> `

I don't think it matters. As far as I know, the offset is just another
way of representing the same information.

By the way, the (Cons (Cons (Cons (Cons Empty st.row) pattern should
have constructor `SourceLoc num num num num` of its own in the tra
type (backend_common).

> Another problematic case, where probably I am not passing along the right
> traces in the AallocEmpty case:
>   (compile_exp t env (ast$App op es) =
>     if op = AallocEmpty then
>       FOLDR (Let t NONE) (modLang$App t Aalloc [Lit t (IntLit (&0)); Lit t
> (IntLit (&0))])
>         (REVERSE (compile_exps t env es))
>     else
>       modLang$App t (astOp_to_modOp op) (compile_exps t env es))

Yup, the function needs to become a little bit more complicated in
order to ensure that each constructor has a unique trace t.

More information about the Developers mailing list