lfortran icon indicating copy to clipboard operation
lfortran copied to clipboard

Allow to take ASR as text and compile via LFortran

Open certik opened this issue 1 year ago • 2 comments

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.

certik avatar Aug 23 '24 17:08 certik

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.

Pranavchiku avatar Aug 26 '24 04:08 Pranavchiku

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.

certik avatar Aug 26 '24 13:08 certik