Skip to content

Commit

Permalink
completed FP types
Browse files Browse the repository at this point in the history
  • Loading branch information
jtristan committed Sep 13, 2024
1 parent f37a1f5 commit 5d66573
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion SHerLOC/AST1.lean
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ structure IntegerType where
deriving Repr, Inhabited, Nonempty

inductive FloatType where
| f8E3M4
| f8E4M3
| f8E4M3FN
| f8E5M2
| f8E4M3FNUZ
Expand Down Expand Up @@ -273,7 +275,6 @@ mutual
| func (literal : FuncId)
| list (literal : List Literal)
| dictionary (literal : List Attribute)
| use_global_device_ids
| array (literal : ArrayLiteral)

deriving Repr, Inhabited, Nonempty
Expand Down
5 changes: 2 additions & 3 deletions SHerLOC/Parsing/Intermediate.lean
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ mutual

partial def parseAttribute : PState Attribute := do
push "parseAttribute"
if ← isParse "use_global_device_ids" then -- Review
if ← isParse "use_global_device_ids" then
pop "parseAttribute"
throw <| ← error "use_global_device_ids"
-- return -- Attribute.mk "use_global_device_ids" { literal := Literal.use_global_device_ids, typ := none }}
return Attribute.mk "use_global_device_ids" <| Constant.mk (Literal.element (ElementLiteral.booleanLiteral BooleanLiteral.true)) none
else
let id ← parseId
parseItem "="
Expand Down
2 changes: 2 additions & 0 deletions SHerLOC/Parsing/Types.lean
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ def tryParseFloatType : PState (Option FloatType) := do
if ← isParse "f16" then r := some FloatType.f16
if ← isParse "f32" then r := some FloatType.f32
if ← isParse "f64" then r := some FloatType.f64
if ← isParse "f8E3M4" then r := some FloatType.f8E3M4
if ← isParse "f8E4M3B11FNUZ" then r := some FloatType.f8E4M3B11FNUZ
if ← isParse "f8E4M3FNUZ" then r := some FloatType.f8E4M3FNUZ
if ← isParse "f8E4M3FN" then r := some FloatType.f8E4M3FN
if ← isParse "f8E4M3" then r := some FloatType.f8E4M3
if ← isParse "f8E5M2FNUZ" then r := some FloatType.f8E5M2FNUZ
if ← isParse "f8E5M2" then r := some FloatType.f8E5M2
}
Expand Down

0 comments on commit 5d66573

Please sign in to comment.