Skip to content

Commit

Permalink
Merge pull request lcompilers#258 from certik/lf_remove2
Browse files Browse the repository at this point in the history
Remove LFortran's AST to ASR and associated tests
  • Loading branch information
certik authored Mar 19, 2022
2 parents 37ed5de + 3e95b31 commit 662e0c4
Show file tree
Hide file tree
Showing 16 changed files with 4 additions and 7,161 deletions.
2 changes: 1 addition & 1 deletion ci/build.xsh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ BUILD_TYPE = "Release"
cmake -G $LFORTRAN_CMAKE_GENERATOR -DCMAKE_VERBOSE_MAKEFILE=ON -DWITH_LLVM=yes -DWITH_XEUS=yes -DCMAKE_PREFIX_PATH=$CONDA_PREFIX -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DWITH_LFORTRAN_BINARY_MODFILES=no -DCMAKE_BUILD_TYPE=@(BUILD_TYPE) ..
cmake --build . --target install
./src/lpython/tests/test_lfortran
./src/bin/lpython < ../src/bin/example_input.txt
#./src/bin/lpython < ../src/bin/example_input.txt
ctest --output-on-failure
cpack -V
cd ../..
Expand Down
8 changes: 1 addition & 7 deletions src/bin/lpython.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <lpython/parser/parser.h>
#include <lpython/parser/preprocessor.h>
#include <lpython/pickle.h>
#include <lpython/semantics/ast_to_asr.h>
#include <lpython/semantics/python_ast_to_asr.h>
#include <lpython/mod_to_asr.h>
#include <libasr/codegen/asr_to_llvm.h>
Expand All @@ -33,7 +32,6 @@
#include <libasr/asr_verify.h>
#include <libasr/modfile.h>
#include <libasr/config.h>
#include <lpython/fortran_kernel.h>
#include <libasr/string_utils.h>
#include <lpython/utils.h>
#include <lpython/python_serialization.h>
Expand Down Expand Up @@ -1366,12 +1364,8 @@ int main(int argc, char *argv[])
// }

if (kernel) {
#ifdef HAVE_LFORTRAN_XEUS
return LFortran::run_kernel(arg_kernel_f);
#else
std::cerr << "The kernel subcommand requires LFortran to be compiled with XEUS support. Recompile with `WITH_XEUS=yes`." << std::endl;
std::cerr << "The kernel subcommand is not implemented yet for LPython." << std::endl;
return 1;
#endif
}

// if (mod) {
Expand Down
5 changes: 1 addition & 4 deletions src/lpython/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ set(SRC
parser/parser.tab.cc
parser/parser.cpp

semantics/ast_symboltable_visitor.cpp
semantics/ast_body_visitor.cpp
semantics/ast_to_asr.cpp
semantics/python_ast_to_asr.cpp

fortran_evaluator.cpp
Expand All @@ -27,7 +24,7 @@ set(SRC
)
if (WITH_XEUS)
set(SRC ${SRC}
fortran_kernel.cpp
# fortran_kernel.cpp
)
endif()
if (WITH_JSON)
Expand Down
12 changes: 1 addition & 11 deletions src/lpython/fortran_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <libasr/exception.h>
#include <lpython/ast.h>
#include <libasr/asr.h>
#include <lpython/semantics/ast_to_asr.h>
#include <lpython/parser/parser.h>
#include <lpython/parser/preprocessor.h>
#include <lpython/pickle.h>
Expand Down Expand Up @@ -225,7 +224,7 @@ Result<ASR::TranslationUnit_t*> FortranEvaluator::get_asr2(
}

Result<ASR::TranslationUnit_t*> FortranEvaluator::get_asr3(
AST::TranslationUnit_t &ast, diag::Diagnostics &diagnostics)
AST::TranslationUnit_t &/*ast*/, diag::Diagnostics &/*diagnostics*/)
{
ASR::TranslationUnit_t* asr;
// AST -> ASR
Expand All @@ -236,15 +235,6 @@ Result<ASR::TranslationUnit_t*> FortranEvaluator::get_asr3(
}
symbol_table->mark_all_variables_external(al);
}
auto res = ast_to_asr(al, ast, diagnostics, symbol_table,
compiler_options.symtab_only);
if (res.ok) {
asr = res.result;
} else {
LFORTRAN_ASSERT(diagnostics.has_error())
return res.error;
}
if (!symbol_table) symbol_table = asr->m_global_scope;

return asr;
}
Expand Down
Loading

0 comments on commit 662e0c4

Please sign in to comment.