Compilation 如何理解idris中的SDecl?

Compilation 如何理解idris中的SDecl?,compilation,functional-programming,idris,Compilation,Functional Programming,Idris,我正在为idris编写一个后端,idris代码(缩写) 生成了以下内容: (SLet (Loc 1) (SLet (Loc 1) (SConst "hello\n") (SOp LWriteStr [Loc 0,Loc 1])) (SCon Nothing 0 MkUnit []) ) 如何理解那里的locn?这与德布鲁金指数有关吗?这是一个SExp,而不是TT,所以它还没有去布鲁金指数化: Module

我正在为idris编写一个后端,idris代码(缩写)

生成了以下内容:

(SLet
    (Loc 1)
    (SLet
        (Loc 1)
        (SConst "hello\n")
        (SOp LWriteStr [Loc 0,Loc 1]))
    (SCon Nothing 0 MkUnit [])
    )

如何理解那里的
locn
?这与德布鲁金指数有关吗?

这是一个
SExp
,而不是
TT
,所以它还没有去布鲁金指数化:

Module      : IRTS.Simplified
Description : Simplified expressions, where functions/constructors can only be applied to variables.
SLoc n
只是一个生成的标识符,因此在您的示例中,内部的
SLet
会对外部(未使用的)
SLet
产生阴影;它可以被糖化成糖

let v1 = let v1 = "hello\n" in writeStr v0 v1
in v1
或者,也可以为变量指定唯一的名称

let v1 = let v2 = "hello\n" in writeStr v0 v2
in v1
请注意,
LWriteStr
loc0
参数未绑定在此片段中;我猜这将是传递给
main
IO
世界令牌,因此整个
main
将是

\v0 => let v1 = let v2 = "hello\n" in writeStr v0 v2 in v1
\v0 => let v1 = let v2 = "hello\n" in writeStr v0 v2 in v1