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

Update LFortran version #116

Merged
merged 2 commits into from
Oct 25, 2023
Merged
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
2 changes: 1 addition & 1 deletion utils/commit.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"id": "bf7d47ec6",
"id": "c96370c9a",
"build_type": "release"
}
71 changes: 37 additions & 34 deletions utils/preinstalled_programs.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,21 @@ end program`,
end program mandelbrot`
},
experimental: {
template_add: `module template_add_m
template_add: `module template_add_01_m
implicit none
private
public :: add_t

requirement R(T, F)
type :: T; end type
type, deferred :: T
function F(x, y) result(z)
type(T), intent(in) :: x, y
type(T) :: z
end function
end requirement

template add_t(T, F)
requires R(T, F)
require :: R(T, F)
private
public :: add_generic
contains
Expand Down Expand Up @@ -117,28 +117,28 @@ contains
end subroutine
end module

program template_add
use template_add_m
program template_add_01
use template_add_01_m
implicit none

call test_template()

end program template_add`,
end program`,
template_nested: `module template_nested_m
implicit none
private
public :: add_t

requirement R(T, F)
type :: T; end type
type, deferred :: T
function F(x, y) result(z)
type(T), intent(in) :: x, y
type(T) :: z
end function
end requirement

template add_t(T, F)
requires R(T, F)
require :: R(T, F)
private
public :: add_generic
contains
Expand Down Expand Up @@ -179,7 +179,7 @@ implicit none
call test_template()

end program template_nested`,
template_travel: `module math
template_travel: `module template_travel_01_math

implicit none
private
Expand All @@ -201,17 +201,17 @@ contains

end module

module travel
module template_travel_01_travel

use math
use template_travel_01_math
implicit none
private
public :: travel_tmpl

requirement operations(D, T, S, plus_D, plus_T, D_divided_by_T, D_divided_by_S)
type :: D; end type
type :: T; end type
type :: S; end type
type, deferred :: D
type, deferred :: T
type, deferred :: S

pure function plus_D(l, r) result(total)
type(D), intent(in) :: l, R
Expand All @@ -237,7 +237,7 @@ module travel
end requirement

template travel_tmpl(D, T, S, plus_D, plus_T, D_divided_by_T, D_divided_by_S)
requires operations(D, T, S, plus_D, plus_T, D_divided_by_T, D_divided_by_S)
require :: operations(D, T, S, plus_D, plus_T, D_divided_by_T, D_divided_by_S)
private
public :: avg_S_from_T
contains
Expand All @@ -258,10 +258,10 @@ module travel

end module

module template_travel_m
module template_travel_01_m

use math
use travel
use template_travel_01_math
use template_travel_01_travel
implicit none

contains
Expand All @@ -280,13 +280,14 @@ contains

end module

program template_travel
use template_travel_m
program template_travel_01
use template_travel_01_m
implicit none

call test_template()

end program template_travel`,
end program template_travel_01
`,
template_triple: `module Math_integer_m

implicit none
Expand Down Expand Up @@ -388,7 +389,7 @@ end program template_travel`,
public :: triple_tmpl

requirement magma_r(T, plus_T)
type :: T; end type
type, deferred :: T

pure function plus_T(l, r) result(total)
type(T), intent(in) :: l, r
Expand All @@ -397,7 +398,7 @@ end program template_travel`,
end requirement

template triple_tmpl(T, plus_T)
requires magma_r(T, plus_T)
require :: magma_r(T, plus_T)
private
public :: triple_l, triple_r
contains
Expand Down Expand Up @@ -471,11 +472,11 @@ end program template_travel`,
public :: test_template

requirement r(t)
type :: t; end type
type, deferred :: t
end requirement

template array_tmpl(t)
requires r(t)
require :: r(t)
private
public :: insert_t
contains
Expand Down Expand Up @@ -552,7 +553,7 @@ module template_array_02b_m
public :: test_template

requirement operations(t, plus_t, zero_t)
type :: t; end type
type, deferred :: t

pure function plus_t(l, r) result(rs)
type(t), intent(in) :: l, r
Expand All @@ -566,7 +567,7 @@ module template_array_02b_m
end requirement

template array_tmpl(t, plus_t, zero_t)
requires operations(t, plus_t, zero_t)
require :: operations(t, plus_t, zero_t)
private
public :: mysum_t
contains
Expand Down Expand Up @@ -604,7 +605,7 @@ program template_array_02b
call test_template()

end`,
template_array_03: `module math
template_array_03: `module template_array_03_math

implicit none
private
Expand Down Expand Up @@ -652,14 +653,14 @@ end module

module template_array_03_m

use math
use template_array_03_math
implicit none
private
public :: test_template

requirement operations(t, plus_t, zero_t, mult_t)

type :: t; end type
type, deferred :: t

pure function plus_t(l, r) result(result)
type(t), intent(in) :: l, r
Expand All @@ -680,7 +681,7 @@ module template_array_03_m
!
template array_tmpl(t, plus_t, zero_t, mult_t)

requires operations(t, plus_t, zero_t, mult_t)
require :: operations(t, plus_t, zero_t, mult_t)
private
public :: mymatmul_t

Expand All @@ -690,7 +691,7 @@ module template_array_03_m
integer, parameter, intent(in) :: i, j, k
type(t), intent(in) :: a(i,j), b(j,k)
type(t) :: r(i,k)
integer, parameter :: x, y, z
integer, parameter :: x = 1, y = 1, z = 1
type(t) :: elem
do x = 1, i
do z = 1, k
Expand Down Expand Up @@ -739,11 +740,11 @@ end`,
public :: reverse_tmpl

requirement default_behavior(t)
type :: t; end type
type, deferred :: t
end requirement

template reverse_tmpl(t)
requires default_behavior(t)
require :: default_behavior(t)
private
public :: reverse
contains
Expand Down Expand Up @@ -774,6 +775,8 @@ contains
a = [1,2,3,4,5]
call ireverse(a)
print *, a
if (a(1) /= 5) error stop
if (a(5) /= 1) error stop
end subroutine

end module
Expand Down
Loading