Skip to content

Make simple calculations work via LLVM in interactive mode

Fixes #156 (closed).

An example:

$ ./src/bin/lfortran 
Interactive Fortran. Experimental prototype, not ready for end users.
  * Use Ctrl-D to exit
  * Use Enter to submit
Try: function f(); f = 42; end function
>>> 3+5
Input:
3+5
AST:
(TranslationUnit [(+ 3 5)])
ASR:
(TranslationUnit (SymbolTable 13759a54 {}) [(BinOp (Num 3 (Integer 8 [])) operatorType0 (Num 5 (Integer 8 [])) (Integer 8 []))])
LLVM IR:
; ModuleID = 'LFortran'
source_filename = "LFortran"

define i64 @f() {
EntryBlock:
  ret i64 8
}

Result:
8
>>> 

Merge request reports

Loading