Excessive newlines in printing ASR expression
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.2k
- Forks
- 271
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 173
Description
Original issue: https://gitlab.com/lfortran/lfortran/-/issues/110
Attempting to convert a directly constructed LFortran ASR object to source code
prints an excessive number of newlines in the resulting expression:
>>> integer = lfortran.asr.builder.make_type_integer()
>>> a = lfortran.asr.asr.Variable(name="a", type=integer)
>>> b = lfortran.asr.asr.Variable(name="b", type=integer)
>>> expr = lfortran.asr.builder.make_binop(a, lfortran.asr.asr.Add(), b)
>>> lfortran.ast_to_src(lfortran.asr_to_ast(expr))
'a\n \n+\n \nb\n'
I'm not sure whether this is the right way to print the resulting string (that's
at least how its done in the builder test, though it's applied to an entire
module).
I'm currently using LFortran 0.1.14, distributed by PyPI.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the lfortran.asr.builder and the asr_to_ast and ast_to_src entry points used in the reproduction, then compare them with the builder test mentioned in the issue. Verify how a directly constructed binary expression is converted and printed; done means the expression no longer contains unexplained extra newlines.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100