Skip to content

Commit 1e0d300

Browse files
authored
Merge pull request #2836 from Shaikh-Ubaid/ubaid/pr/libasr_sync
Sync LibASR with LFortran
2 parents 635ed20 + 2eb4bc3 commit 1e0d300

File tree

739 files changed

+10905
-117441
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

739 files changed

+10905
-117441
lines changed

.github/workflows/CI.yml

+73-7
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,14 @@ jobs:
2424
steps:
2525
- uses: actions/checkout@v3
2626
with:
27+
submodules: true
2728
fetch-depth: 0
2829

30+
- name: Git Submodule Update
31+
shell: bash -e -l {0}
32+
run: |
33+
git submodule update --init --recursive
34+
2935
- name: Cache conda
3036
uses: actions/cache@v3
3137
env:
@@ -122,8 +128,14 @@ jobs:
122128
steps:
123129
- uses: actions/checkout@v3
124130
with:
131+
submodules: true
125132
fetch-depth: 0
126133

134+
- name: Git Submodule Update
135+
shell: bash -e -l {0}
136+
run: |
137+
git submodule update --init --recursive
138+
127139
- uses: mamba-org/setup-micromamba@v1
128140
with:
129141
environment-file: ci/environment.yml
@@ -190,8 +202,14 @@ jobs:
190202
steps:
191203
- uses: actions/checkout@v3
192204
with:
205+
submodules: true
193206
fetch-depth: 0
194207

208+
- name: Git Submodule Update
209+
shell: bash -e -l {0}
210+
run: |
211+
git submodule update --init --recursive
212+
195213
- uses: mamba-org/setup-micromamba@v1
196214
with:
197215
environment-file: ci/environment.yml
@@ -243,21 +261,27 @@ jobs:
243261
run: |
244262
python integration_tests/test_pip_import_01.py
245263
246-
- name: Test PIP Packages with LPython
247-
shell: bash -e -l {0}
248-
run: |
249-
pip_pkg_path=$(python -c "import site; print(site.getsitepackages()[0])")
250-
echo $pip_pkg_path
251-
./src/bin/lpython integration_tests/test_pip_import_01.py -I $pip_pkg_path
264+
# - name: Test PIP Packages with LPython
265+
# shell: bash -e -l {0}
266+
# run: |
267+
# pip_pkg_path=$(python -c "import site; print(site.getsitepackages()[0])")
268+
# echo $pip_pkg_path
269+
# ./src/bin/lpython integration_tests/test_pip_import_01.py -I $pip_pkg_path
252270

253271
debug:
254272
name: Check Debug build
255273
runs-on: ubuntu-latest
256274
steps:
257275
- uses: actions/checkout@v3
258276
with:
277+
submodules: true
259278
fetch-depth: 0
260279

280+
- name: Git Submodule Update
281+
shell: bash -e -l {0}
282+
run: |
283+
git submodule update --init --recursive
284+
261285
- uses: mamba-org/setup-micromamba@v1
262286
with:
263287
environment-file: ci/environment.yml
@@ -303,8 +327,14 @@ jobs:
303327
steps:
304328
- uses: actions/checkout@v3
305329
with:
330+
submodules: true
306331
fetch-depth: 0
307332

333+
- name: Git Submodule Update
334+
shell: bash -e -l {0}
335+
run: |
336+
git submodule update --init --recursive
337+
308338
- uses: mamba-org/setup-micromamba@v1
309339
with:
310340
environment-file: ci/environment.yml
@@ -351,8 +381,14 @@ jobs:
351381
steps:
352382
- uses: actions/checkout@v3
353383
with:
384+
submodules: true
354385
fetch-depth: 0
355386

387+
- name: Git Submodule Update
388+
shell: bash -e -l {0}
389+
run: |
390+
git submodule update --init --recursive
391+
356392
- uses: mamba-org/setup-micromamba@v1
357393
with:
358394
environment-file: ci/environment.yml
@@ -395,8 +431,14 @@ jobs:
395431
steps:
396432
- uses: actions/checkout@v3
397433
with:
434+
submodules: true
398435
fetch-depth: 0
399436

437+
- name: Git Submodule Update
438+
shell: bash -e -l {0}
439+
run: |
440+
git submodule update --init --recursive
441+
400442
- uses: mamba-org/setup-micromamba@v1
401443
with:
402444
environment-file: ci/environment.yml
@@ -444,8 +486,14 @@ jobs:
444486
steps:
445487
- uses: actions/checkout@v3
446488
with:
489+
submodules: true
447490
fetch-depth: 0
448491

492+
- name: Git Submodule Update
493+
shell: bash -e -l {0}
494+
run: |
495+
git submodule update --init --recursive
496+
449497
- uses: mamba-org/setup-micromamba@v1
450498
with:
451499
environment-name: lp
@@ -507,8 +555,14 @@ jobs:
507555
steps:
508556
- uses: actions/checkout@v4
509557
with:
558+
submodules: true
510559
fetch-depth: 0
511560

561+
- name: Git Submodule Update
562+
shell: bash -e -l {0}
563+
run: |
564+
git submodule update --init --recursive
565+
512566
- uses: mamba-org/[email protected]
513567
with:
514568
environment-file: ci/environment_linux_llvm.yml
@@ -552,8 +606,14 @@ jobs:
552606
steps:
553607
- uses: actions/checkout@v3
554608
with:
609+
submodules: true
555610
fetch-depth: 0
556611

612+
- name: Git Submodule Update
613+
shell: bash -e -l {0}
614+
run: |
615+
git submodule update --init --recursive
616+
557617
- uses: mamba-org/setup-micromamba@v1
558618
with:
559619
environment-file: ci/environment.yml
@@ -594,8 +654,14 @@ jobs:
594654
steps:
595655
- uses: actions/checkout@v4
596656
with:
657+
submodules: true
597658
fetch-depth: 0
598659

660+
- name: Git Submodule Update
661+
shell: bash -e -l {0}
662+
run: |
663+
git submodule update --init --recursive
664+
599665
- uses: mamba-org/setup-micromamba@v1
600666
with:
601667
environment-file: ci/environment.yml
@@ -606,7 +672,7 @@ jobs:
606672
shell: bash -e -l {0}
607673
run: |
608674
./build0.sh
609-
lpython_version=$(<version)
675+
lpython_version=$(<lp_version)
610676
ci/create_source_tarball.sh $lpython_version
611677
612678
- name: Upload Tarball to Release

.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,21 @@ src/libasr/asr.h
6060
src/libasr/wasm_visitor.h
6161
src/libasr/pass/intrinsic_function_registry_util.h
6262
src/libasr/config.h
63+
src/libasr/asr_base_visitor.h
64+
src/libasr/asr_deserialization_visitor.h
65+
src/libasr/asr_expr_base_replacer_visitor.h
66+
src/libasr/asr_expr_call_replacer_visitor.h
67+
src/libasr/asr_expr_stmt_duplicator_visitor.h
68+
src/libasr/asr_expr_type_visitor.h
69+
src/libasr/asr_expr_value_visitor.h
70+
src/libasr/asr_json_visitor.h
71+
src/libasr/asr_lookup_name_visitor.h
72+
src/libasr/asr_pass_walk_visitor.h
73+
src/libasr/asr_pickle_visitor.h
74+
src/libasr/asr_serialization_visitor.h
75+
src/libasr/asr_stmt_base_replacer_visitor.h
76+
src/libasr/asr_tree_visitor.h
77+
src/libasr/asr_walk_visitor.h
6378
share/jupyter/kernels/fortran/kernel.json
6479
share/jupyter/kernels/lpython/kernel.json
6580
src/runtime/*.o.empty.c

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "libasr"]
2+
path = libasr
3+
url = https://github.com/lfortran/lfortran.git

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if (LPYTHON_BUILD_ALL)
77
execute_process(COMMAND "build0.sh")
88
endif()
99

10-
file(STRINGS "version" LFORTRAN_VERSION)
10+
file(STRINGS "lp_version" LFORTRAN_VERSION)
1111

1212
project(lpython LANGUAGES C CXX)
1313

build0.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ ci/version.sh
88
# Generate a Python AST from Python.asdl (Python)
99
python grammar/asdl_py.py
1010
# Generate a Python AST from Python.asdl (C++)
11-
python src/libasr/asdl_cpp.py grammar/Python.asdl src/lpython/python_ast.h
11+
python libasr/src/libasr/asdl_cpp.py grammar/Python.asdl src/lpython/python_ast.h
1212
# Generate a Fortran ASR from ASR.asdl (C++)
13-
python src/libasr/asdl_cpp.py src/libasr/ASR.asdl src/libasr/asr.h
14-
# Generate a wasm_visitor.h from src/libasr/wasm_instructions.txt (C++)
15-
python src/libasr/wasm_instructions_visitor.py
13+
python libasr/src/libasr/asdl_cpp.py libasr/src/libasr/ASR.asdl libasr/src/libasr/asr.h
14+
# Generate a wasm_visitor.h from libasr/src/libasr/wasm_instructions.txt (C++)
15+
python libasr/src/libasr/wasm_instructions_visitor.py
1616
# Generate the intrinsic_function_registry_util.h (C++)
17-
python src/libasr/intrinsic_func_registry_util_gen.py
17+
python libasr/src/libasr/intrinsic_func_registry_util_gen.py
1818

1919
# Generate the tokenizer and parser
2020
(cd src/lpython/parser && re2c -W -b tokenizer.re -o tokenizer.cpp)

build0_win.xsh

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ echo @(version) > version
77
# Generate a Python AST from Python.asdl (Python)
88
python grammar/asdl_py.py
99
# Generate a Python AST from Python.asdl (C++)
10-
python src/libasr/asdl_cpp.py grammar/Python.asdl src/lpython/python_ast.h
10+
python libasr/src/libasr/asdl_cpp.py grammar/Python.asdl src/lpython/python_ast.h
1111
# Generate a Fortran ASR from ASR.asdl (C++)
12-
python src/libasr/asdl_cpp.py src/libasr/ASR.asdl src/libasr/asr.h
13-
# Generate a wasm_visitor.h from src/libasr/wasm_instructions.txt (C++)
14-
python src/libasr/wasm_instructions_visitor.py
12+
python libasr/src/libasr/asdl_cpp.py libasr/src/libasr/ASR.asdl libasr/src/libasr/asr.h
13+
# Generate a wasm_visitor.h from libasr/src/libasr/wasm_instructions.txt (C++)
14+
python libasr/src/libasr/wasm_instructions_visitor.py
1515
# Generate the intrinsic_function_registry_util.h (C++)
16-
python src/libasr/intrinsic_func_registry_util_gen.py
16+
python libasr/src/libasr/intrinsic_func_registry_util_gen.py
1717

1818
# Generate the tokenizer and parser
1919
pushd src/lpython/parser && re2c -W -b tokenizer.re -o tokenizer.cpp && popd

ci/build.xsh

+6-6
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@ llvm-config --components
2727
bash ci/version.sh
2828

2929
# Generate a Fortran ASR from ASR.asdl (C++)
30-
python src/libasr/asdl_cpp.py src/libasr/ASR.asdl src/libasr/asr.h
30+
python libasr/src/libasr/asdl_cpp.py libasr/src/libasr/ASR.asdl libasr/src/libasr/asr.h
3131
# Generate a Python AST from Python.asdl (C++)
32-
python src/libasr/asdl_cpp.py grammar/Python.asdl src/lpython/python_ast.h
32+
python libasr/src/libasr/asdl_cpp.py grammar/Python.asdl src/lpython/python_ast.h
3333
# Generate a Python AST from Python.asdl (Python)
3434
python grammar/asdl_py.py
35-
# Generate a wasm_visitor.h from src/libasr/wasm_instructions.txt (C++)
36-
python src/libasr/wasm_instructions_visitor.py
35+
# Generate a wasm_visitor.h from libasr/src/libasr/wasm_instructions.txt (C++)
36+
python libasr/src/libasr/wasm_instructions_visitor.py
3737
# Generate the intrinsic_function_registry_util.h (C++)
38-
python src/libasr/intrinsic_func_registry_util_gen.py
38+
python libasr/src/libasr/intrinsic_func_registry_util_gen.py
3939

4040
# Generate the tokenizer and parser
4141
pushd src/lpython/parser && re2c -W -b tokenizer.re -o tokenizer.cpp && popd
4242
pushd src/lpython/parser && bison -Wall -d -r all parser.yy && popd
4343

44-
$lpython_version=$(cat version).strip()
44+
$lpython_version=$(cat lp_version).strip()
4545
$dest="lpython-" + $lpython_version
4646
bash ci/create_source_tarball0.sh
4747
tar xzf dist/lpython-$lpython_version.tar.gz

ci/create_source_tarball0.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ cmake -E copy_directory src $dest/src
99
cmake -E copy_directory share $dest/share
1010
cmake -E copy_directory cmake $dest/cmake
1111
cmake -E copy_directory examples $dest/examples
12+
cmake -E copy_directory libasr/src/libasr $dest/libasr/src/libasr
1213

1314
# Copy Files:
14-
cmake -E copy CMakeLists.txt README.md LICENSE version $dest
15+
cmake -E copy CMakeLists.txt README.md LICENSE lp_version $dest
1516

1617
# Create the tarball
1718
cmake -E make_directory dist

ci/test.xsh

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ src/bin/lpython -o expr2 expr2.o
1313
# Test the new Python frontend, manually for now:
1414
src/bin/lpython --show-ast tests/doconcurrentloop_01.py
1515
src/bin/lpython --show-asr tests/doconcurrentloop_01.py
16-
src/bin/lpython --show-cpp tests/doconcurrentloop_01.py
16+
# src/bin/lpython --show-cpp tests/doconcurrentloop_01.py
1717

1818
if $WIN == "1":
1919
python run_tests.py --skip-run-with-dbg --no-color

ci/version.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ set -ex
1515

1616
version=$(git describe --tags --dirty)
1717
version="${version:1}"
18-
echo $version > version
18+
echo $version > lp_version

grammar/asdl_py.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import sys
66
import os
77

8-
sys.path.append("src/libasr")
8+
sys.path.append("libasr/src/libasr")
99
import asdl
1010

1111
products = []

0 commit comments

Comments
 (0)