Skip to content

Instantly share code, notes, and snippets.

@liarokapisv
Created January 19, 2018 19:32
Show Gist options
  • Save liarokapisv/5e7208ccc6ab4accf097a7dc54475760 to your computer and use it in GitHub Desktop.
Save liarokapisv/5e7208ccc6ab4accf097a7dc54475760 to your computer and use it in GitHub Desktop.
Why not total?
mutual
renameFuncCall : AnnFuncCall ParserAnn -> Renamer (AnnFuncCall RenamerAnn)
renameFuncCall ((MkFuncCall x xs) .+. y) = [| [| MkFuncCall (renameIdentifier Func x)
(traverse renameExpr xs) |] .+. [|y|] |]
renameExpr : AnnExpr ParserAnn -> Renamer (AnnExpr RenamerAnn)
renameExpr ((IntConst x) .+. y) = [| [| IntConst (renameIntConst x) |] .+. [|y|] |]
renameExpr ((CharConst x) .+. y) = [| [| CharConst (renameCharConst x) |] .+. [|y|] |]
renameExpr ((Lvalue x) .+. y) = [| [| Lvalue (renameLvalue x) |] .+. [|y|] |]
renameExpr ((Paren x) .+. y) = [| [| Paren (renameExpr x) |] .+. [|y|] |]
renameExpr ((FuncCall x) .+. y) = [| [| FuncCall (renameFuncCall x) |] .+. [|y|] |]
renameExpr ((Plus x) .+. y) = [| [| Plus (renameExpr x) |] .+. [|y|] |]
renameExpr ((Minus x) .+. y) = [| [| Minus (renameExpr x) |] .+. [|y|] |]
renameExpr ((x :+: z) .+. y) = [| [| (renameExpr x) :+: (renameExpr z)|] .+. [|y|] |]
renameExpr ((x :-: z) .+. y) = [| [| (renameExpr x) :-: (renameExpr z)|] .+. [|y|] |]
renameExpr ((x :*: z) .+. y) = [| [| (renameExpr x) :*: (renameExpr z)|] .+. [|y|] |]
renameExpr ((x :/: z) .+. y) =[| [| (renameExpr x) :/: (renameExpr z) |] .+. [|y|] |]
renameExpr ((x :%: z) .+. y) =[| [| (renameExpr x) :%: (renameExpr z) |] .+. [|y|] |]
renameExpr (True .+. y) = [| [|True|] .+. [|y|] |]
renameExpr (False .+. y) = [| [|False|] .+. [|y|] |]
renameExpr ((Not x) .+. y) = [| [| Not (renameExpr x) |] .+. [|y|] |]
renameExpr ((x :&: z) .+. y) = [| [| (renameExpr x) :&: (renameExpr z) |] .+. [|y|] |]
renameExpr ((x :|: z) .+. y) = [| [| (renameExpr x) :|: (renameExpr z) |] .+. [|y|] |]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment