Skip to content

Commit

Permalink
Add IR parsing for ArrayVal.
Browse files Browse the repository at this point in the history
  • Loading branch information
athas committed Jul 3, 2024
1 parent 4800376 commit 402493f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/Futhark/IR/Parse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,10 @@ pBasicOp =
<*> pFlatSlice
<* lexeme "="
<*> pVName,
try $
ArrayVal
<$> brackets (pPrimValue `sepBy` pComma)
<*> (lexeme ":" *> "[]" *> pPrimType),
ArrayLit
<$> brackets (pSubExp `sepBy` pComma)
<*> (lexeme ":" *> "[]" *> pType),
Expand Down
6 changes: 5 additions & 1 deletion src/Futhark/IR/Pretty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,11 @@ instance Pretty BasicOp where
<+> colon
<+> "[]"
<> pretty rt
pretty (ArrayVal vs _) = brackets $ commasep $ map pretty vs
pretty (ArrayVal vs t) =
brackets (commasep $ map pretty vs)
<+> colon
<+> "[]"
<> pretty t
pretty (BinOp bop x y) = pretty bop <> parens (pretty x <> comma <+> pretty y)
pretty (CmpOp op x y) = pretty op <> parens (pretty x <> comma <+> pretty y)
pretty (ConvOp conv x) =
Expand Down

0 comments on commit 402493f

Please sign in to comment.