Re:LPython: Novel, Fast, Retargetable Python Compiler
by rebcabin001 on Saturday July 29, 2023 @01:39PM
(#36922580)
ASR abstracts away all syntax and all details of the target machine, no leaks. Contrast to the schoolbook approach of decorating ASTs with semantic information, which often reflects details of a target machine.
[ Parent
| on HN ]
Re:LPython: Novel, Fast, Retargetable Python Compiler
by rebcabin001 on Saturday July 29, 2023 @01:54PM
(#36922751)
Implication is that ASR is a full programming language in its own right (though with no quality-of-life features: everything is explicit, and it's also currently restricted to the operations featured by LFortran and LPython: heavily array-oriented for now, ASR grows as LFortran and LPython grow). I've prototyped, in Clojure, an independent type-checker for ASR (https://github.com/rebcabin/masr), and an interpreter (for "abstract execution") should not be difficult.
Re:LPython: Novel, Fast, Retargetable Python Compiler
by certik on Saturday July 29, 2023 @02:42PM
(#36923187)
Yes. ASR is as abstract as it can be, but it is still faithful to the original language, no information has been lost, nothing was lowered.
Re:LPython: Novel, Fast, Retargetable Python Compiler
by rebcabin001 on Saturday July 29, 2023 @02:58PM
(#36923330)
Right. Decompilation with ASR should be relatively easy and more faithful than average decompilation (though, as mentioned by another commenter, the very-long-term value of decompilation in general is debatable in the face of rising AI like CoPilot).
Re:LPython: Novel, Fast, Retargetable Python Compiler
by peterfirefly on Saturday July 29, 2023 @03:21PM
(#36923559)
How do you manage to do that for Python AND Fortran in the same language?
Re:LPython: Novel, Fast, Retargetable Python Compiler
by certik on Saturday July 29, 2023 @04:19PM
(#36924135)
By being a superset of Fortran and subset of Python. It turns out the features map on each other almost 1:1, and the differences can be taken care of by the respective frontends, so the abstracted ASR maps perfectly.
Re:LPython: Novel, Fast, Retargetable Python Compiler
by rebcabin001 on Sunday July 30, 2023 @10:37AM
(#36931569)
Sometimes, standard semantical approaches assume a target stack-machine, or SSA architecture, or something else with insufficient generality to cover all the cases we want (e.g., non-Von architectures like APU from GSIT). ASR assumes only lambda/pi/rho calculus, depending on whether you want concurrency semantics (that's TBD, frankly; today it's justs lambda)