Skip to content

Commit

Permalink
resolved conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
czgdp1807 committed Apr 1, 2021
2 parents fd6cd7c + d23c083 commit 8675a5a
Show file tree
Hide file tree
Showing 259 changed files with 4,242 additions and 781 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ src/lfortran/tests/test_llvm
src/lfortran/tests/test_parse
src/lfortran/tests/test_pickle
src/lfortran/tests/test_stacktrace*
src/lfortran/tests/test_serialization*
src/lfortran/tests/test_cwrapper
src/lfortran/tests/test_serialization
src/lfortran/tests/write32
src/lfortran/tests/write32.asm
src/lfortran/tests/subroutines32
Expand Down
22 changes: 17 additions & 5 deletions grammar/ASR.asdl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ unit
-- abi=Source means the symbol's implementation is included (full ASR),
-- otherwise it is external (interface ASR, such as procedure interface).

-- SubroutineCall/FuncCall store the actual final resolved subroutine or
-- SubroutineCall/FunctionCall store the actual final resolved subroutine or
-- function (`name` member). They also store the original symbol
-- (`original_name`), which can be one of: null, GenericProcedure or
-- ExternalSymbol.
Expand All @@ -60,23 +60,34 @@ unit
-- used. After the ASR is loaded, the symbols that are used are represented as
-- ExternalSymbols in the current scope of the symbol table.

-- ExternalSymbol represents symbols that cannot be looked up in the current
-- scoped symbol table. As an example, if a variable is defined in a module,
-- but used in a nested subroutine, that is not an external symbol
-- because it can be resolved in the current symbol table (nested subroutine)
-- by following the parents. However if a symbol is used from a different
-- module, then it is an external symbol, because usual symbol resolution by
-- going to the parents will not find the definition.

-- REPL: each cell is parsed into full ASR, compiled + executed, the full ASR
-- is transformed into interface ASR (abi=LFortran) and kept in the symbol
-- table. A new cell starts with an empty symbol table, whose parent symbol
-- table is the previous cell. That allows function / declaration shadowing.


symbol
= Program(symbol_table symtab, identifier name, stmt* body)
| Module(symbol_table symtab, identifier name)
= Program(symbol_table symtab, identifier name, identifier* dependencies,
stmt* body)
| Module(symbol_table symtab, identifier name, identifier* dependencies,
bool loaded_from_mod)
| Subroutine(symbol_table symtab, identifier name, expr* args, stmt* body,
abi abi, access access)
| Function(symbol_table symtab, identifier name, expr* args, stmt* body,
expr return_var, abi abi, access access)
| GenericProcedure(symbol_table parent_symtab, identifier name,
symbol* procs, access access)
| ExternalSymbol(symbol_table parent_symtab, identifier name,
symbol external, access acess)
symbol external, identifier module_name, identifier original_name,
access access)
| DerivedType(symbol_table symtab, identifier name, abi abi, access access)
| Variable(symbol_table parent_symtab, identifier name, intent intent,
expr? value, storage_type storage, ttype type, abi abi, access access)
Expand Down Expand Up @@ -147,7 +158,7 @@ expr
| StrOp(expr left, strop op, expr right, ttype type)
| UnaryOp(unaryop op, expr operand, ttype type)
| Compare(expr left, cmpop op, expr right, ttype type)
| FuncCall(symbol name, symbol? original_name, expr* args,
| FunctionCall(symbol name, symbol? original_name, expr* args,
keyword* keywords, ttype type)
| ArrayInitializer(expr* args, ttype type)
| ConstantInteger(int n, ttype type)
Expand Down Expand Up @@ -192,6 +203,7 @@ cast_kind
| RealToComplex
| IntegerToComplex
| IntegerToLogical
| ComplexToComplex

dimension = (expr? start, expr? end)

Expand Down
2 changes: 2 additions & 0 deletions grammar/AST.asdl
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ stmt
= Assignment(expr target, expr value)
| Associate(expr target, expr value)
| SubroutineCall(identifier name, fnarg* args, keyword* keywords)
| Allocate(fnarg* args, keyword* keywords)
| Deallocate(fnarg* args)
| BuiltinCall(identifier name, expr* args)
| If(expr test, stmt* body, stmt* orelse)
| Where(expr test, stmt* body, stmt* orelse)
Expand Down
Loading

0 comments on commit 8675a5a

Please sign in to comment.