Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

structural control flow #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions src/expr/cf/data.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
@data Stmt begin
Index(Index.Type)
Scalar(Scalar.Type)
Region(Region.Type)
Op(Op.Type)
State(State.Type)
Tensor(Tensor.Type)
end

"""
Structural Control Flow
"""
@data CF begin
None
Break
Continue

struct If
cond::Stmt.Type
then::CF
otherwise::CF
end

struct While
cond::Stmt.Type
body::CF
end

struct For
index::Vector{Index.Type}
region::Region.Type
body::CF
end

Return(Stmt.Type)

Block(Vector{Stmt.Type})
end
1 change: 1 addition & 0 deletions src/expr/cf/mod.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include("data.jl")
1 change: 1 addition & 0 deletions src/expr/mod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ include("state/mod.jl")
include("region/mod.jl")
include("op/mod.jl")
include("tensor/mod.jl")
include("cf/mod.jl")

"""
@def <name>::<type>
Expand Down