Tangence::Compiler::Parser - parse Tangence interface definition files
Tangence::Compiler::Parser
Tangence
This subclass of Parser::MGC parses a Tangence interface definition and returns a metadata tree.
The top level of an interface definition file contains include directives and class and struct definitions.
include
class
struct
An include directive imports the definitions from another file, named relative to the current file.
include "filename.tan"
A class definition defines the set of methods, events and properties defined by a named class.
class N { ... }
The contents of the class block will be a list of method, event, prop and isa declarations.
method
event
prop
isa
A struct definition defines the list of fields contained within a named structure type.
struct N { ... }
The contents of the struct block will be a list of field declarations.
field
A method declaration defines one method in the class, giving its name (N) and types of its arguments and and return (T).
method N(T, T, ...) -> T;
An event declaration defines one event raised by the class, giving its name (N) and types of its arguments (T).
event N(T, T, ...);
A prop declaration defines one property supported by the class, giving its name (N), dimension (D) and type (T). It may be declared as a smashed property.
smashed
[smashed] prop N = D of T;
Scalar properties may omit the scalar of, by supplying just the type
scalar of
[smashed] prop N = T;
An isa declaration declares a superclass of the class, by its name (C)
isa C;
The following basic type names are recognised
bool int str obj any s8 s16 s32 s64 u8 u16 u32 u64
Aggregate types may be formed of any type (T) by
list(T) dict(T)
If this class is subclassed, the following methods may be overridden to customise the behaviour. They allow the subclass to return different objects in the syntax tree.
Return a new instance of Tangence::Meta::Class to go in a package. The parser will call define on it.
define
Return a new instance of Tangence::Meta::Struct to go in a package. The parser will call define on it.
Return a new instance of Tangence::Meta::Method, Tangence::Meta::Event or Tangence::Meta::Property to go in a class.
Return a new instance of Tangence::Meta::Argument to use for a method or event argument.
Return a new instance of Tangence::Meta::Field to use for a structure type.
Return an instance of Tangence::Meta::Type representing the given primitive or aggregate type name. An implementation is allowed to use singleton objects and return identical objects for the same primitive name or aggregate and member type.
Paul Evans <leonerd@leonerd.org.uk>
To install Tangence, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tangence
CPAN shell
perl -MCPAN -e shell install Tangence
For more information on module installation, please visit the detailed CPAN module installation guide.