forked from lcompilers/lpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AST: Add stmt_name for cycle See merge request lfortran/lfortran!910
- Loading branch information
Showing
16 changed files
with
37 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,4 +113,5 @@ MANIFEST | |
output | ||
*.o | ||
*.out | ||
*.mod | ||
/.ccls-cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(TranslationUnit [(Program doloop_04 [] [(ImplicitNone [])] [(Declaration (AttrType TypeInteger [] ()) [] [(i [] ()) (j [] ())])] [(= 0 j 0) (DoLoop 0 a i 1 10 () [(= 0 j (+ j i)) (If 0 () (== i 2) [(Exit 0)] [])]) (If 0 () (/= j 3) [(ErrorStop 0 ())] []) (= 0 j 0) (DoLoop 0 b i 1 10 2 [(= 0 j (+ j i)) (If 0 () (== i 3) [(Exit 0)] [])]) (If 0 () (/= j 4) [(ErrorStop 0 ())] []) (= 0 j 0) (= 0 i 1) (DoLoop 0 c () () () () [(= 0 j (+ j i)) (If 0 () (== i 2) [(Exit 0)] []) (= 0 i (+ i 1))]) (If 0 () (/= j 3) [(ErrorStop 0 ())] [])] [])]) | ||
(TranslationUnit [(Program doloop_04 [] [(ImplicitNone [])] [(Declaration (AttrType TypeInteger [] ()) [] [(i [] ()) (j [] ())])] [(= 0 j 0) (DoLoop 0 a i 1 10 () [(= 0 j (+ j i)) (If 0 () (== i 2) [(Exit 0 a)] [])]) (If 0 () (/= j 3) [(ErrorStop 0 ())] []) (= 0 j 0) (DoLoop 0 b i 1 10 2 [(= 0 j (+ j i)) (If 0 () (== i 3) [(Exit 0 b)] [])]) (If 0 () (/= j 4) [(ErrorStop 0 ())] []) (= 0 j 0) (= 0 i 1) (DoLoop 0 c () () () () [(= 0 j (+ j i)) (If 0 () (== i 2) [(Exit 0 c)] []) (= 0 i (+ i 1))]) (If 0 () (/= j 3) [(ErrorStop 0 ())] [])] [])]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(TranslationUnit [(Module random [(Use types [(UseSymbol dp ())]) (Use utils [(UseSymbol stop_error ())])] [(ImplicitNone [])] [(Declaration () [(SimpleAttribute AttrPrivate)] []) (Declaration () [(SimpleAttribute AttrPublic)] [(randn [] ()) (rand_gamma [] ())]) (Interface (InterfaceHeader2 randn) [(InterfaceModuleProcedure [randn_scalar]) (InterfaceModuleProcedure [randn_vector]) (InterfaceModuleProcedure [randn_matrix]) (InterfaceModuleProcedure [randn_vector_n])]) (Interface (InterfaceHeader2 rand_gamma) [(InterfaceModuleProcedure [rand_gamma_scalar]) (InterfaceModuleProcedure [rand_gamma_vector]) (InterfaceModuleProcedure [rand_gamma_matrix]) (InterfaceModuleProcedure [rand_gamma_vector_n])])] [(Subroutine randn_scalar [(x)] () [] [] [] [(Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent Out)] [(x [] ())]) (Declaration (AttrType TypeLogical [] ()) [(SimpleAttribute AttrSave)] [(first [] (Logical .true.))]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [(SimpleAttribute AttrSave)] [(u [(1 2 DimensionExpr)] ())]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [] [(r2 [] ())])] [(If 0 () first [(DoLoop 0 () () () () () [(SubroutineCall 0 random_number [(() u ())] []) (= 0 u (- (* 2 u) 1)) (= 0 r2 (FuncCallOrArray sum [] [(() (** u 2) ())] [])) (If 0 () (BoolOp (< r2 1) And (> r2 0)) [(Exit 0)] [])]) (= 0 u (* u (FuncCallOrArray sqrt [] [(() (/ (* (u- 2) (FuncCallOrArray log [] [(() r2 ())] [])) r2) ())] []))) (= 0 x (FuncCallOrArray u [] [(() 1 ())] []))] [(= 0 x (FuncCallOrArray u [] [(() 2 ())] []))]) (= 0 first (not first))] []) (Subroutine randn_vector_n [(n) (x)] () [] [] [] [(Declaration (AttrType TypeInteger [] ()) [(AttrIntent In)] [(n [] ())]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent Out)] [(x [(1 n DimensionExpr)] ())]) (Declaration (AttrType TypeInteger [] ()) [] [(i [] ())])] [(DoLoop 0 () i 1 (FuncCallOrArray size [] [(() x ())] []) () [(SubroutineCall 0 randn [(() (FuncCallOrArray x [] [(() i ())] []) ())] [])])] []) (Subroutine randn_vector [(x)] () [] [] [] [(Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent Out)] [(x [(() () DimensionExpr)] ())])] [(SubroutineCall 0 randn_vector_n [(() (FuncCallOrArray size [] [(() x ())] []) ()) (() x ())] [])] []) (Subroutine randn_matrix [(x)] () [] [] [] [(Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent Out)] [(x [(() () DimensionExpr) (() () DimensionExpr)] ())])] [(SubroutineCall 0 randn_vector_n [(() (FuncCallOrArray size [] [(() x ())] []) ()) (() x ())] [])] []) (Subroutine rand_gamma0 [(a) (first) (fn_val)] () [] [] [] [(Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent In)] [(a [] ())]) (Declaration (AttrType TypeLogical [] ()) [(AttrIntent In)] [(first [] ())]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent Out)] [(fn_val [] ())]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [(SimpleAttribute AttrSave)] [(c [] ()) (d [] ())]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [] [(U [] ()) (v [] ()) (x [] ())])] [(If 0 () (< a 1) [(SubroutineCall 0 stop_error [(() (Str "Shape parameter must be >= 1") ())] [])] []) (If 0 () first [(= 0 d (- a (/ (Real "1._dp") 3))) (= 0 c (/ 1 (FuncCallOrArray sqrt [] [(() (* 9 d) ())] [])))] []) (DoLoop 0 () () () () () [(DoLoop 0 () () () () () [(SubroutineCall 0 randn [(() x ())] []) (= 0 v (** (+ 1 (* c x)) 3)) (If 0 () (> v 0) [(Exit 0)] [])]) (SubroutineCall 0 random_number [(() U ())] []) (If 0 () (< U (- 1 (* (Real "0.0331_dp") (** x 4)))) [(= 0 fn_val (* d v)) (Exit 0)] [(If 0 () (< (FuncCallOrArray log [] [(() U ())] []) (+ (/ (** x 2) 2) (* d (+ (- 1 v) (FuncCallOrArray log [] [(() v ())] []))))) [(= 0 fn_val (* d v)) (Exit 0)] [])])])] []) (Subroutine rand_gamma_scalar [(a) (x)] () [] [] [] [(Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent In)] [(a [] ())]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent Out)] [(x [] ())])] [(SubroutineCall 0 rand_gamma0 [(() a ()) (() (Logical .true.) ()) (() x ())] [])] []) (Subroutine rand_gamma_vector_n [(a) (n) (x)] () [] [] [] [(Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent In)] [(a [] ())]) (Declaration (AttrType TypeInteger [] ()) [(AttrIntent In)] [(n [] ())]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent Out)] [(x [(1 n DimensionExpr)] ())]) (Declaration (AttrType TypeInteger [] ()) [] [(i [] ())])] [(SubroutineCall 0 rand_gamma0 [(() a ()) (() (Logical .true.) ()) (() (FuncCallOrArray x [] [(() 1 ())] []) ())] []) (DoLoop 0 () i 2 (FuncCallOrArray size [] [(() x ())] []) () [(SubroutineCall 0 rand_gamma0 [(() a ()) (() (Logical .false.) ()) (() (FuncCallOrArray x [] [(() i ())] []) ())] [])])] []) (Subroutine rand_gamma_vector [(a) (x)] () [] [] [] [(Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent In)] [(a [] ())]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent Out)] [(x [(() () DimensionExpr)] ())])] [(SubroutineCall 0 rand_gamma_vector_n [(() a ()) (() (FuncCallOrArray size [] [(() x ())] []) ()) (() x ())] [])] []) (Subroutine rand_gamma_matrix [(a) (x)] () [] [] [] [(Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent In)] [(a [] ())]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent Out)] [(x [(() () DimensionExpr) (() () DimensionExpr)] ())])] [(SubroutineCall 0 rand_gamma_vector_n [(() a ()) (() (FuncCallOrArray size [] [(() x ())] []) ()) (() x ())] [])] [])])]) | ||
(TranslationUnit [(Module random [(Use types [(UseSymbol dp ())]) (Use utils [(UseSymbol stop_error ())])] [(ImplicitNone [])] [(Declaration () [(SimpleAttribute AttrPrivate)] []) (Declaration () [(SimpleAttribute AttrPublic)] [(randn [] ()) (rand_gamma [] ())]) (Interface (InterfaceHeader2 randn) [(InterfaceModuleProcedure [randn_scalar]) (InterfaceModuleProcedure [randn_vector]) (InterfaceModuleProcedure [randn_matrix]) (InterfaceModuleProcedure [randn_vector_n])]) (Interface (InterfaceHeader2 rand_gamma) [(InterfaceModuleProcedure [rand_gamma_scalar]) (InterfaceModuleProcedure [rand_gamma_vector]) (InterfaceModuleProcedure [rand_gamma_matrix]) (InterfaceModuleProcedure [rand_gamma_vector_n])])] [(Subroutine randn_scalar [(x)] () [] [] [] [(Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent Out)] [(x [] ())]) (Declaration (AttrType TypeLogical [] ()) [(SimpleAttribute AttrSave)] [(first [] (Logical .true.))]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [(SimpleAttribute AttrSave)] [(u [(1 2 DimensionExpr)] ())]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [] [(r2 [] ())])] [(If 0 () first [(DoLoop 0 () () () () () [(SubroutineCall 0 random_number [(() u ())] []) (= 0 u (- (* 2 u) 1)) (= 0 r2 (FuncCallOrArray sum [] [(() (** u 2) ())] [])) (If 0 () (BoolOp (< r2 1) And (> r2 0)) [(Exit 0 ())] [])]) (= 0 u (* u (FuncCallOrArray sqrt [] [(() (/ (* (u- 2) (FuncCallOrArray log [] [(() r2 ())] [])) r2) ())] []))) (= 0 x (FuncCallOrArray u [] [(() 1 ())] []))] [(= 0 x (FuncCallOrArray u [] [(() 2 ())] []))]) (= 0 first (not first))] []) (Subroutine randn_vector_n [(n) (x)] () [] [] [] [(Declaration (AttrType TypeInteger [] ()) [(AttrIntent In)] [(n [] ())]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent Out)] [(x [(1 n DimensionExpr)] ())]) (Declaration (AttrType TypeInteger [] ()) [] [(i [] ())])] [(DoLoop 0 () i 1 (FuncCallOrArray size [] [(() x ())] []) () [(SubroutineCall 0 randn [(() (FuncCallOrArray x [] [(() i ())] []) ())] [])])] []) (Subroutine randn_vector [(x)] () [] [] [] [(Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent Out)] [(x [(() () DimensionExpr)] ())])] [(SubroutineCall 0 randn_vector_n [(() (FuncCallOrArray size [] [(() x ())] []) ()) (() x ())] [])] []) (Subroutine randn_matrix [(x)] () [] [] [] [(Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent Out)] [(x [(() () DimensionExpr) (() () DimensionExpr)] ())])] [(SubroutineCall 0 randn_vector_n [(() (FuncCallOrArray size [] [(() x ())] []) ()) (() x ())] [])] []) (Subroutine rand_gamma0 [(a) (first) (fn_val)] () [] [] [] [(Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent In)] [(a [] ())]) (Declaration (AttrType TypeLogical [] ()) [(AttrIntent In)] [(first [] ())]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent Out)] [(fn_val [] ())]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [(SimpleAttribute AttrSave)] [(c [] ()) (d [] ())]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [] [(U [] ()) (v [] ()) (x [] ())])] [(If 0 () (< a 1) [(SubroutineCall 0 stop_error [(() (Str "Shape parameter must be >= 1") ())] [])] []) (If 0 () first [(= 0 d (- a (/ (Real "1._dp") 3))) (= 0 c (/ 1 (FuncCallOrArray sqrt [] [(() (* 9 d) ())] [])))] []) (DoLoop 0 () () () () () [(DoLoop 0 () () () () () [(SubroutineCall 0 randn [(() x ())] []) (= 0 v (** (+ 1 (* c x)) 3)) (If 0 () (> v 0) [(Exit 0 ())] [])]) (SubroutineCall 0 random_number [(() U ())] []) (If 0 () (< U (- 1 (* (Real "0.0331_dp") (** x 4)))) [(= 0 fn_val (* d v)) (Exit 0 ())] [(If 0 () (< (FuncCallOrArray log [] [(() U ())] []) (+ (/ (** x 2) 2) (* d (+ (- 1 v) (FuncCallOrArray log [] [(() v ())] []))))) [(= 0 fn_val (* d v)) (Exit 0 ())] [])])])] []) (Subroutine rand_gamma_scalar [(a) (x)] () [] [] [] [(Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent In)] [(a [] ())]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent Out)] [(x [] ())])] [(SubroutineCall 0 rand_gamma0 [(() a ()) (() (Logical .true.) ()) (() x ())] [])] []) (Subroutine rand_gamma_vector_n [(a) (n) (x)] () [] [] [] [(Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent In)] [(a [] ())]) (Declaration (AttrType TypeInteger [] ()) [(AttrIntent In)] [(n [] ())]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent Out)] [(x [(1 n DimensionExpr)] ())]) (Declaration (AttrType TypeInteger [] ()) [] [(i [] ())])] [(SubroutineCall 0 rand_gamma0 [(() a ()) (() (Logical .true.) ()) (() (FuncCallOrArray x [] [(() 1 ())] []) ())] []) (DoLoop 0 () i 2 (FuncCallOrArray size [] [(() x ())] []) () [(SubroutineCall 0 rand_gamma0 [(() a ()) (() (Logical .false.) ()) (() (FuncCallOrArray x [] [(() i ())] []) ())] [])])] []) (Subroutine rand_gamma_vector [(a) (x)] () [] [] [] [(Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent In)] [(a [] ())]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent Out)] [(x [(() () DimensionExpr)] ())])] [(SubroutineCall 0 rand_gamma_vector_n [(() a ()) (() (FuncCallOrArray size [] [(() x ())] []) ()) (() x ())] [])] []) (Subroutine rand_gamma_matrix [(a) (x)] () [] [] [] [(Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent In)] [(a [] ())]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent Out)] [(x [(() () DimensionExpr) (() () DimensionExpr)] ())])] [(SubroutineCall 0 rand_gamma_vector_n [(() a ()) (() (FuncCallOrArray size [] [(() x ())] []) ()) (() x ())] [])] [])])]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(TranslationUnit [(Program program_01 [] [(ImplicitNone [])] [(Declaration (AttrType TypeInteger [] ()) [(SimpleAttribute AttrParameter)] [(dp [] (FuncCallOrArray kind [] [(() (Real "0.d0") ())] []))]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [] [(a [] ())]) (Declaration (AttrType TypeInteger [] ()) [] [(i [] ())])] [(Print 0 () [(Str "Normal random numbers:")]) (DoLoop 0 () i 1 10 () [(SubroutineCall 0 rand [(() a ())] []) (Print 0 () [a])])] [(Subroutine rand [(x)] () [] [] [] [(Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent Out)] [(x [] ())]) (Declaration (AttrType TypeLogical [] ()) [(SimpleAttribute AttrSave)] [(first [] (Logical .true.))]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [(SimpleAttribute AttrSave)] [(u [(1 2 DimensionExpr)] ())]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [] [(r2 [] ())])] [(If 0 () first [(DoLoop 0 () () () () () [(SubroutineCall 0 random_number [(() u ())] []) (= 0 u (- (* 2 u) 1)) (= 0 r2 (FuncCallOrArray sum [] [(() (** u 2) ())] [])) (If 0 () (BoolOp (< r2 1) And (> r2 0)) [(Exit 0)] [])]) (= 0 u (* u (FuncCallOrArray sqrt [] [(() (/ (* (u- 2) (FuncCallOrArray log [] [(() r2 ())] [])) r2) ())] []))) (= 0 x (FuncCallOrArray u [] [(() 1 ())] []))] [(= 0 x (FuncCallOrArray u [] [(() 2 ())] []))]) (= 0 first (not first))] [])])]) | ||
(TranslationUnit [(Program program_01 [] [(ImplicitNone [])] [(Declaration (AttrType TypeInteger [] ()) [(SimpleAttribute AttrParameter)] [(dp [] (FuncCallOrArray kind [] [(() (Real "0.d0") ())] []))]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [] [(a [] ())]) (Declaration (AttrType TypeInteger [] ()) [] [(i [] ())])] [(Print 0 () [(Str "Normal random numbers:")]) (DoLoop 0 () i 1 10 () [(SubroutineCall 0 rand [(() a ())] []) (Print 0 () [a])])] [(Subroutine rand [(x)] () [] [] [] [(Declaration (AttrType TypeReal [(() dp Value)] ()) [(AttrIntent Out)] [(x [] ())]) (Declaration (AttrType TypeLogical [] ()) [(SimpleAttribute AttrSave)] [(first [] (Logical .true.))]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [(SimpleAttribute AttrSave)] [(u [(1 2 DimensionExpr)] ())]) (Declaration (AttrType TypeReal [(() dp Value)] ()) [] [(r2 [] ())])] [(If 0 () first [(DoLoop 0 () () () () () [(SubroutineCall 0 random_number [(() u ())] []) (= 0 u (- (* 2 u) 1)) (= 0 r2 (FuncCallOrArray sum [] [(() (** u 2) ())] [])) (If 0 () (BoolOp (< r2 1) And (> r2 0)) [(Exit 0 ())] [])]) (= 0 u (* u (FuncCallOrArray sqrt [] [(() (/ (* (u- 2) (FuncCallOrArray log [] [(() r2 ())] [])) r2) ())] []))) (= 0 x (FuncCallOrArray u [] [(() 1 ())] []))] [(= 0 x (FuncCallOrArray u [] [(() 2 ())] []))]) (= 0 first (not first))] [])])]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.