Skip to content

Commit

Permalink
Add documentation to AST and ASR asdl files
Browse files Browse the repository at this point in the history
  • Loading branch information
certik committed Mar 4, 2021
1 parent 1c9ccb2 commit e839ddc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
17 changes: 13 additions & 4 deletions grammar/ASR.asdl
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
-- Abstract Semantic Representation (ASR) definition

-- The aim of ASR is to represent all semantics in a non-redundant way,
-- and that has all the information available locally, so that the backend
-- can do a single pass over ASR and have all the information at hand to
-- generate code.
-- The aim of ASR is to represent all semantics in a non-redundant way, and that
-- has all the semantic information available locally, so that the backend can
-- do a single pass over ASR and have all the information at hand to generate
-- code.
--
-- ASR is always semantically valid Fortran code. It is as far from the original
-- Fortran language code as possible (i.e. everthing is explicitly figured out,
-- all semantic information gathered and readily available locally from each ASR
-- node), while ensuring no semantic information was lost (no lowering was
-- done), so one can still generate Fortran code from ASR that will be logically
-- equivalent to the original code.
--
-- ASR can be used to do Fortran level transformations (such as optimizations).

-- ASDL's builtin types are:
-- * identifier
Expand Down
6 changes: 6 additions & 0 deletions grammar/AST.asdl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
-- Specific tools may choose to produce language interfaces that represent
-- these types and the ASDL tree in a language specific way (e.g. use finite
-- precision integers and signal an error otherwise).
--
-- At the AST level we strictly only represent local syntax (no semantics). That
-- way each syntax construct is parsed locally, no need to do any non-local
-- lookups to figure out what AST node to construct. That is the job of the AST
-- to ASR conversion to do non-local lookups to figure out what is what (i.e.,
-- disambiguate) and report any errors.

module AST {

Expand Down

0 comments on commit e839ddc

Please sign in to comment.