Skip to content

Draft: Initial implementation of statement functions

Ondřej Čertík requested to merge certik/lfortran:statement_function into master

This has lots of conflicts, so that has to be resolved.

Now this:

program Axxxxxxxxxx
CHARACTER(len=4) :: T
!
ROTX(X,Y)=CO*X-SI*Y+X01
ROTY(X,Y)=SI*X+CO*Y+Y01
DATA SPACE/0.08/
integer :: c2
a(x) = 3
integer :: c
!
TL=0.1            ! TICK LENGTH
end

Parses to:

(TranslationUnit [(Program Axxxxxxxxxx () [] [] [(Declaration (AttrType TypeCharacter [(len 4 Value)] () None) [] [(T [] [] () None ())] (TriviaNode [] [(EndOfLine) (Comment "!")])) (StatementFunction ROTX (+ (- (* CO X) (* SI Y)) X01) ()) (StatementFunction ROTY (+ (+ (* SI X) (* CO Y)) Y01) ()) (Declaration () [(AttrData [SPACE] [(Real "0.08")])] [] ()) (Declaration (AttrType TypeInteger [] () None) [] [(c2 [] [] () None ())] ()) (StatementFunction a 3 ()) (Declaration (AttrType TypeInteger [] () None) [] [(c [] [] () None ())] (TriviaNode [] [(EndOfLine) (Comment "!")]))] [(= 0 TL (Real "0.1") (TriviaNode [] [(EOLComment "! TICK LENGTH")]))] [])])

Towards fixing #474 (closed).

Edited by Ondřej Čertík

Merge request reports