Program

Program symbol, a symbol node.

声明

语法

Program(symbol_table symtab, identifier name, identifier* dependencies,
	    stmt* body)

参数

symtab the symbol table of the program.

name the name of the program.

dependencies the module names that the program depends on.

body the list of statements that the program contains.

返回值

无。

描述

ASR pass transforms (in-place) the ASR tree and wraps all global statements and expressions into a program.

类型

示例

program expr2
integer :: x
x = (2+3)*5
print *, x
end program

ASR:

(TranslationUnit
    (SymbolTable
        1
        {
            expr2:
                (Program
                    (SymbolTable
                        2
                        {
                            x:
                                (Variable
                                    2
                                    x
                                    Local
                                    ()
                                    ()
                                    Default
                                    (Integer 4 [])
                                    Source
                                    Public
                                    Required
                                    .false.
                                )

                        })
                    expr2
                    []
                    [(=
                        (Var 2 x)
                        (IntegerBinOp
                            (IntegerBinOp
                                (IntegerConstant 2 (Integer 4 []))
                                Add
                                (IntegerConstant 3 (Integer 4 []))
                                (Integer 4 [])
                                (IntegerConstant 5 (Integer 4 []))
                            )
                            Mul
                            (IntegerConstant 5 (Integer 4 []))
                            (Integer 4 [])
                            (IntegerConstant 25 (Integer 4 []))
                        )
                        ()
                    )
                    (Print
                        ()
                        [(Var 2 x)]
                        ()
                        ()
                    )]
                )

        })
    []
)

也可以看看

Module, Function.