Skip to content

Lfortran libasr sync #2833

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

Closed
wants to merge 21 commits into from
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 6 additions & 6 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,12 @@ jobs:
run: |
python integration_tests/test_pip_import_01.py

- name: Test PIP Packages with LPython
shell: bash -e -l {0}
run: |
pip_pkg_path=$(python -c "import site; print(site.getsitepackages()[0])")
echo $pip_pkg_path
./src/bin/lpython integration_tests/test_pip_import_01.py -I $pip_pkg_path
# - name: Test PIP Packages with LPython
# shell: bash -e -l {0}
# run: |
# pip_pkg_path=$(python -c "import site; print(site.getsitepackages()[0])")
# echo $pip_pkg_path
# ./src/bin/lpython integration_tests/test_pip_import_01.py -I $pip_pkg_path

debug:
name: Check Debug build
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "libasr"]
path = libasr
url = https://github.com/lfortran/lfortran.git
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if (LPYTHON_BUILD_ALL)
execute_process(COMMAND "build0.sh")
endif()

file(STRINGS "version" LFORTRAN_VERSION)
file(STRINGS "lpython_version" LFORTRAN_VERSION)

project(lpython LANGUAGES C CXX)

Expand Down Expand Up @@ -348,3 +348,4 @@ message("WITH_TARGET_X86: ${WITH_TARGET_X86}")


add_subdirectory(src)
add_subdirectory(libasr/src/libasr)
8 changes: 4 additions & 4 deletions build0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ ci/version.sh
# Generate a Python AST from Python.asdl (Python)
python grammar/asdl_py.py
# Generate a Python AST from Python.asdl (C++)
python src/libasr/asdl_cpp.py grammar/Python.asdl src/lpython/python_ast.h
python libasr/src/libasr/asdl_cpp.py grammar/Python.asdl src/lpython/python_ast.h
# Generate a Fortran ASR from ASR.asdl (C++)
python src/libasr/asdl_cpp.py src/libasr/ASR.asdl src/libasr/asr.h
python libasr/src/libasr/asdl_cpp.py libasr/src/libasr/ASR.asdl libasr/src/libasr/asr.h
# Generate a wasm_visitor.h from src/libasr/wasm_instructions.txt (C++)
python src/libasr/wasm_instructions_visitor.py
python libasr/src/libasr/wasm_instructions_visitor.py
# Generate the intrinsic_function_registry_util.h (C++)
python src/libasr/intrinsic_func_registry_util_gen.py
python libasr/src/libasr/intrinsic_func_registry_util_gen.py

# Generate the tokenizer and parser
(cd src/lpython/parser && re2c -W -b tokenizer.re -o tokenizer.cpp)
Expand Down
2 changes: 1 addition & 1 deletion ci/test.xsh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ src/bin/lpython -o expr2 expr2.o
# Test the new Python frontend, manually for now:
src/bin/lpython --show-ast tests/doconcurrentloop_01.py
src/bin/lpython --show-asr tests/doconcurrentloop_01.py
src/bin/lpython --show-cpp tests/doconcurrentloop_01.py
# src/bin/lpython --show-cpp tests/doconcurrentloop_01.py

if $WIN == "1":
python run_tests.py --skip-run-with-dbg --no-color
Expand Down
2 changes: 1 addition & 1 deletion ci/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ set -ex

version=$(git describe --tags --dirty)
version="${version:1}"
echo $version > version
echo $version > lpython_version
2 changes: 1 addition & 1 deletion grammar/asdl_py.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys
import os

sys.path.append("src/libasr")
sys.path.append("libasr/src/libasr")
import asdl

products = []
Expand Down
404 changes: 202 additions & 202 deletions integration_tests/CMakeLists.txt

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions integration_tests/array_expr_05.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from lpython import u8, u16, u32, u64
from lpython import u8, u16, u32, u64, i8
from numpy import uint8, uint16, uint32, uint64, array

def g():
Expand All @@ -7,11 +7,6 @@ def g():
a32: u32[3] = array([127, 3, 111], dtype=uint32)
a64: u64[3] = array([127, 3, 111], dtype=uint64)

print(a8)
print(a16)
print(a32)
print(a64)

assert (a8[0] == u8(127))
assert (a8[1] == u8(3))
assert (a8[2] == u8(111))
Expand All @@ -28,4 +23,9 @@ def g():
assert (a64[1] == u64(3))
assert (a64[2] == u64(111))

print(a8)
print(a16)
print(a32)
print(a64)

g()
2 changes: 1 addition & 1 deletion integration_tests/bindc_02.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ def f():

yptr1 = c_p_pointer(yq, i16[:], array([2]))

print(yq, yptr1)
# print(yq, yptr1)

f()
1 change: 1 addition & 0 deletions libasr
Submodule libasr added at 7a9f53
2 changes: 1 addition & 1 deletion run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from compiler_tester.tester import color, fg, log, run_test, style, tester_main


def single_test(test, verbose, no_llvm, skip_run_with_dbg, skip_cpptranslate, update_reference,
def single_test(test, verbose, no_llvm, skip_run_with_dbg, update_reference,
verify_hash, no_color, specific_backends=None, excluded_backends=None):
filename = test["filename"]
def is_included(backend):
Expand Down
5 changes: 3 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
add_subdirectory(libasr)
# add_subdirectory(libasr)
# add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../libasr/src/libasr)
add_subdirectory(tests)
add_subdirectory(lpython)
add_subdirectory(bin)
add_subdirectory(runtime/legacy)
# add_subdirectory(runtime/legacy)
16 changes: 8 additions & 8 deletions src/bin/lpython.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,9 +856,9 @@ int interactive_python_repl(
std::cout << " - History (Keys: Up, Down)" << std::endl;

std::vector<std::string> history;

std::function<bool(std::string)> iscomplete = determine_completeness;

std::string code_string;
size_t cell_count = 0;
while (true) {
Expand Down Expand Up @@ -1013,8 +1013,8 @@ int interactive_python_repl(
}
case (LCompilers::PythonCompiler::EvalResult::struct_type) : {
if (verbose) {
std::cout << "Return type: "
<< LCompilers::ASRUtils::get_type_code(r.structure.ttype)
std::cout << "Return type: "
<< LCompilers::ASRUtils::get_type_code(r.structure.ttype)
<< std::endl;
}
if (verbose) section("Result:");
Expand Down Expand Up @@ -1094,7 +1094,7 @@ int compile_python_using_llvm(
}
LCompilers::ASR::TranslationUnit_t* asr = r1.result;
if( compiler_options.po.disable_main ) {
int err = LCompilers::LPython::save_pyc_files(*asr, infile);
int err = LCompilers::LPython::save_pyc_files(*asr, infile, lm);
if( err ) {
return err;
}
Expand Down Expand Up @@ -1237,7 +1237,7 @@ int compile_to_binary_wasm(
}
LCompilers::ASR::TranslationUnit_t* asr = r1.result;
if( compiler_options.po.disable_main ) {
int err = LCompilers::LPython::save_pyc_files(*asr, infile);
int err = LCompilers::LPython::save_pyc_files(*asr, infile, lm);
if( err ) {
return err;
}
Expand Down Expand Up @@ -1310,7 +1310,7 @@ int compile_to_binary_x86(
}
LCompilers::ASR::TranslationUnit_t* asr = r1.result;
if( compiler_options.po.disable_main ) {
int err = LCompilers::LPython::save_pyc_files(*asr, infile);
int err = LCompilers::LPython::save_pyc_files(*asr, infile, lm);
if( err ) {
return err;
}
Expand Down Expand Up @@ -1384,7 +1384,7 @@ int compile_to_binary_wasm_to_x86(
}
LCompilers::ASR::TranslationUnit_t* asr = r1.result;
if( compiler_options.po.disable_main ) {
int err = LCompilers::LPython::save_pyc_files(*asr, infile);
int err = LCompilers::LPython::save_pyc_files(*asr, infile, lm);
if( err ) {
return err;
}
Expand Down
Loading
Loading