class compiler::Parser

sys::Obj
  compiler::CompilerSupport
    compiler::Parser

Source

Parser is responsible for parsing a list of tokens into the abstract syntax tree. At this point the CompilationUnit, Usings, and TypeDefs are already populated by the ScanForUsingAndTypes step.

ProtectionMask

const static Int ProtectionMask := ...

Source

err

virtual override CompilerErr err(Str msg, Loc? loc := null)

Source

make

new make(Compiler compiler, CompilationUnit unit, ClosureExpr[] closures)

Source

Construct the parser for the specified compilation unit.

parse

Void parse()

Source

Top level parse a compilation unit:

<compilationUnit> :=  [<usings>] <typeDef>*
typeDef

Void typeDef()

Source

TypeDef:

<typeDef>      :=  <classDef> | <mixinDef> | <enumDef> | <facetDef>

<classDef>     :=  <classHeader> <classBody>
<classHeader>  :=  [<doc>] <facets> <typeFlags> "class" [<inheritance>]
<classFlags>   :=  [<protection>] ["abstract"] ["final"]
<classBody>    :=  "{" <slotDefs> "}"

<enumDef>      :=  <enumHeader> <enumBody>
<enumHeader>   :=  [<doc>] <facets> <protection> "enum" [<inheritance>]
<enumBody>     :=  "{" <enumDefs> <slotDefs> "}"

<facetDef      :=  <facetHeader> <enumBody>
<facetHeader>  :=  [<doc>] <facets> [<protection>] "facet" "class" <id> [<inheritance>]
<facetBody>    :=  "{" <slotDefs> "}"

<mixinDef>     :=  <enumHeader> <enumBody>
<mixinHeader>  :=  [<doc>] <facets> <protection> "mixin" [<inheritance>]
<mixinBody>    :=  "{" <slotDefs> "}"

<protection>   :=  "public" | "protected" | "private" | "internal"
<inheritance>  :=  ":" <typeList>