Copyright | (c) Kimiyuki Onaka 2021 |
---|---|
License | Apache License 2.0 |
Maintainer | kimiyuki95@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- run :: (MonadAlpha m, MonadError Error m) => Program -> m Program
- run' :: Program -> Program
- runForLoop :: Target' -> Expr' -> [Statement] -> [Statement]
Documentation
run :: (MonadAlpha m, MonadError Error m) => Program -> m Program Source #
run' :: Program -> Program Source #
run
` splits for-loops into many small for-loops as possible.
This assumes that doesntHaveSubscriptionInLoopCounters
, doesntHaveAssignmentToLoopCounters
, and doesntHaveAssignmentToLoopIterators
hold.
This may introduce name conflicts.
For example, the following
a = 0 b = 0 for i in range(10): c = b a += i b += c
is split to
a = 0 b = 0 for i in range(10): c = b b += c for i in range(10): a += i
runForLoop :: Target' -> Expr' -> [Statement] -> [Statement] Source #
runForLoop
splits a for-loop to many for-loops as possible.
This assumes that doesntHaveSubscriptionInLoopCounters
, doesntHaveAssignmentToLoopCounters
, and doesntHaveAssignmentToLoopIterators
hold.
This function analyzes read-variables and write-variables in statements, and split statements into connected components.