Skip to content

Native Types

AbePralle edited this page Jan 4, 2022 · 5 revisions

Syntax

------------------------------------------------------------
nativeTypes
------------------------------------------------------------
Alpha Beta
Gamma, Delta
Epsilon
...

Description

  • Constructors can use native types as parameters / node properties.
  • No extended Cmd node is created for native types.
  • Native types are not visited in Visitor.
  • Native types are copied but not .cloned() in copy constructors.

Example

Here is a parser line that creates an Access node which may resolve to a local variable, a method, etc.:

- access
  on IDENTIFIER
    produce Access(name=content)
  endOn

At the end of the parser is a dummy routine that generates additional node types that will be used in resolving the AST:

- additional_node_types
  create ReadLocal(info:LocalInfo)
  create WriteLocal(info:LocalInfo)

To prevent Froley from assuming LocalInfo is an extended Cmd and adding it to the Visitor infrastructure etc., we'll declare it as a native type:

------------------------------------------------------------
nativeTypes
------------------------------------------------------------
LocalInfo

Clone this wiki locally