The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Tangence::Compiler::Parser - parse Tangence interface definition files

DESCRIPTION

This subclass of Parser::MGC parses a Tangence interface definition and returns a metadata tree.

GRAMMAR

The top level of an interface definition file contains include directives and class definitions.

include

An include directive imports the definitions from another file, named relative to the current file.

 include "filename.tan"

class

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

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;

event

An event declaration defines one event raised by the class, giving its name (N) and types of its arguments (T).

 event N(T, T, ...);

prop

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] prop N = D of T;

Scalar properties may omit the scalar of, by supplying just the type

 [smashed] prop N = T;

isa

An isa declaration declares a superclass of the class, by its name (C)

 isa C;

Types

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)

SUBCLASS METHODS

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.

$class = $parser->make_class( name => $name )

Return a new instance of Tangence::Meta::Class to go in a package. The parser will call define on it.

$method = $parser->make_method( %args )

$event = $parser->make_event( %args )

$property = $parser->make_property( %args )

Return a new instance of Tangence::Meta::Method, Tangence::Meta::Event or Tangence::Meta::Property to go in a class.

$argument = $parser->make_argument( %args )

Return a new instance of Tangence::Meta::Argument to use for a method or event argument.

AUTHOR

Paul Evans <leonerd@leonerd.org.uk>