lfortran
lfortran copied to clipboard
Allow to take ASR as text and compile via LFortran
Similar to https://github.com/lfortran/lfortran/issues/4686, but for ASR text output.
So that the following:
lfortran a.f90
Can also be done using:
lfortran a.f90 --show-asr > a.asr
lfortran a.asr
And it would be equivalent. Furthermore, we can then take the final ASR before LLVM, and then we need to add a simple way to skip all ASR passes in lfortran b.asr, so that we can use b.asr to drive directly our LLVM backend.
This will aid with debugging the LLVM backend, ensuring it works.
Do we not need an ASR parser for this?
Edit: No, we don't, we already have.
ResultASR::TranslationUnit_t* FortranEvaluator::get_asr2( const std::string &code_orig, LocationManager &lm, diag::Diagnostics &diagnostics)
Crap, here const std::string &code_orig means Fortran code. Maybe we need.
Yes, we need an ASR parser: https://github.com/lfortran/lfortran/issues/2357. It's not difficult, but it's also not completely a small task.
The other issue is that we should change the syntax to be completely Clojure syntax: https://github.com/lfortran/lfortran/issues/4694 before doing the parser, otherwise it will be even more work later to change.