You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add Fortran backend, print any ASR (without needing to apply any passes) as Fortran code, figure out how to test it with gfortran; Write Fortran backend for all of ASR, emit readable modern canonical Fortran code: the code will lose some information (such as physical types for arrays, or various casting / dereference nodes) which are only needed for the backends; however each ASR feature will be faithfully lowered to Fortran. This will ensure that ASR stays higher level than Fortran -- for example we should not have assembly instructions as part of ASR.
All types are strictly global, no direct reference to symbol table (possibly with an exception of user defined pure functions); they can thus be reused via pointers; if modification is needed, one must duplicate the type; enforce this and use it when deserializing: provide some machinery to lookup an existing type quickly and get a pointer to it; Using types is thus cheap, just a pointer in each expr node, and so we can use them liberally
runtime library: right now we use BindC and implement all interfacing with the system using it; we need to rather introduce specific ASR nodes for interfacing the system (such as clock, file IO, Intrinsic math functions, etc.), the runtime library will eventually be just pure Fortran (not calls into C), possibly using some "LFortran builtin" functions to access specific functionality, and we can emulate them for other compilers so that we can compile the runtime library with other compilers as well; the previous point actually might solve this issue
Handle invalid code (both syntax errors and semantic errors) with dedicated ASR nodes, so that almost any code can produce an ASR, for language server purposes.
passing arrays to functions, check dimensions at runtime
possibly unifying expr/stmt, or creating "ExprStatement" to represent expressions as statements (in Python and interactive Fortran)
ASR testing: do randomized exhaustive tests (catch all verify and all backends errors)
Figure out a subset of ASR that is complete and add optional ASR passes to lower to this subset; this will enable writing new backends very easily, and together with exhaustive testing we can ensure that these passes + small backend is completely and without bugs, which will harden everything. For performance reasons, our production backends like LLVM should handle a lot more things directly, but we can at least guarantee that the subset works well and is without bugs.
runtime library: possibly have a runtime library in ASR for common functions; that comes much later, first we'll create pure surface level runtime library, then we'll think if it makes sense to share some of the implementations across frontends. Allow surface level implementation of backend runtime features, see WASM: complex numbers lcompilers/lpython#1519 (comment) for details
There are several long standing issues with ASR that need refactoring. We will track of all of them here:
High Priority
=>asAssociate; use full names for all other nodes alsoconstfrom visitors generated viaasdl_cpp.py#4952Partitionin IntrinsicFunction lcompilers/lpython#1673 (comment)FunctionTypein ASR #1189procedure(fn) :: x(I) #1578 (comment)procedure(fn) :: ffunction using keyword arguments likef(a=5)(requirestype_declaration)procedure(fn), pointer :: f; f => my_fn; call f(a=5)Variable(type_declaration=Function), rather thanFunctiondirectly (will simplify the LLVM backend)exprnode, and so we can use them liberallyelemental: Handle IntrinsicFunction in array_op pass #1383sin, simplification: Simplify the Instrinsic Function wrapper #1374maxloc: Initial MaxLoc and MinLoc implementation #1328all: initial implementation in Implement all intrinsic function #1283IntrinsicFunctionSqrt, initially implemented in ASR: Add IntrinsicFunctionSqrt #1227IntrinsicFunctionSqrttoRealSqrtIntrinsicImpureFunctionandIntrinsicImpureSubroutine: Intrinsic function design improvement #1658lfortran_intrinsics.c: WASM: Runtime Library lcompilers/lpython#1413 (comment)elementalexplicitly by introducing a "map" node that maps the scalar function to an array, similar toArrayBroadcast([fortran-primes]: semantic error: mask argument to any must be an array and must not be a scalar #2529 (comment))deterministicandside-effect-freeflags to Function lcompilers/lpython#1293)dpinreal(dp)in the symbol table #8355Medium
Later
For LLVM backend issues see: #1302