equal
deleted
inserted
replaced
807 iType <- gets lastIdTypeDecl |
807 iType <- gets lastIdTypeDecl |
808 e1 <- expr2C e1' |
808 e1 <- expr2C e1' |
809 e2 <- expr2C e2' |
809 e2 <- expr2C e2' |
810 let inc = if up then "inc" else "dec" |
810 let inc = if up then "inc" else "dec" |
811 let add = if up then "+ 1" else "- 1" |
811 let add = if up then "+ 1" else "- 1" |
|
812 let iEnd = i <> text "__end__" |
812 ph <- phrase2C . appendPhrase (BuiltInFunctionCall [Reference $ SimpleReference i'] (SimpleReference (Identifier inc BTUnknown))) $ wrapPhrase p |
813 ph <- phrase2C . appendPhrase (BuiltInFunctionCall [Reference $ SimpleReference i'] (SimpleReference (Identifier inc BTUnknown))) $ wrapPhrase p |
813 return . braces $ |
814 return . braces $ |
814 i <+> text "=" <+> e1 <> semi |
815 i <+> text "=" <+> e1 <> semi |
815 $$ |
816 $$ |
816 iType <+> i <> text "__end__" <+> text "=" <+> e2 <+> text add <> semi |
817 iType <+> iEnd <+> text "=" <+> e2 <> semi |
817 $$ |
818 $$ |
818 text "do" <+> ph <+> |
819 text "if" <+> (parens $ i <+> text "<=" <+> iEnd) <+> text "do" <+> ph <+> |
819 text "while" <> parens (i <+> text "!=" <+> i <> text "__end__") <> semi |
820 text "while" <> parens (i <+> text "!=" <+> iEnd <+> text add) <> semi |
820 where |
821 where |
821 appendPhrase p (Phrases ps) = Phrases $ ps ++ [p] |
822 appendPhrase p (Phrases ps) = Phrases $ ps ++ [p] |
822 phrase2C (RepeatCycle e' p') = do |
823 phrase2C (RepeatCycle e' p') = do |
823 e <- expr2C e' |
824 e <- expr2C e' |
824 p <- phrase2C (Phrases p') |
825 p <- phrase2C (Phrases p') |