AIF

Language Version: 1.0

Document Version: 5-2-2007

Copyright (c) 1999-2008
Maryland DSPCAD Research Group,
The University of Maryland at College Park

Package mapss . dif . aif . sablecc ;

Helpers

all = [ 0 .. 127 ]
digit = [ '0' .. '9' ]
non_digit = [ [ [ 'a' .. 'z' ] + [ 'A' .. 'Z' ] ] + '_' ]
double = ( '+' | '-' ) ? ( digit * ) '.' ( digit + ) ( ( 'e' | 'E' ) ( '+' | '-' ) ? digit + ) ?
integer = ( '-' ) ? digit +
tab = 9
cr = 13
lf = 10
eol = cr lf | cr | lf
not_cr_lf = [ all - [ cr + lf ] ]
not_star = [ all - '*' ]
not_star_slash = [ not_star - '/' ]
short_comment = '//' not_cr_lf * eol
long_comment = '/*' not_star * '*' + ( not_star_slash not_star * '*' + ) * '/'
comment = long_comment | short_comment
simple_escape_sequence = '\' ''' | '\"' | '\\' | '\b' | '\f' | '\n' | '\r' | '\t'
octal_digit = [ '0' .. '7' ]
octal_escape_sequence = '\' octal_digit octal_digit ? octal_digit ?
hexadecimal_digit = [ digit + [ [ 'a' .. 'f' ] + [ 'A' .. 'F' ] ] ]
hexadecimal_escape_sequence = '\x' hexadecimal_digit +
escape_sequence = simple_escape_sequence | octal_escape_sequence | hexadecimal_escape_sequence
s_char = [ all - [ '"' + [ '$' + [ '\' + [ 10 + 13 ] ] ] ] ] | escape_sequence
s_char_sequence = s_char *
string = '"' s_char_sequence '"'
string_identifier = '$' s_char_sequence '$'

Tokens

blank = ( ' ' | tab | eol )
comment = comment
l_bkt = '{'
r_bkt = '}'
l_par = '('
r_par = ')'
l_sqr = '['
r_sqr = ']'
semicolon = ';'
colon = ':'
comma = ','
s_qte = '''
plus = '+'
equal = '='
dot = '.'
map_to = '->'
map_from = '<-'
given_that = '|'
graph = 'graph'
interface = 'interface'
topology = 'topology'
actor = 'actor'
inputs = 'inputs'
outputs = 'outputs'
nodes = 'nodes'
edges = 'edges'
null = 'null'
integer = integer
double = double
true = 'true'
false = 'false'
string = string
string_tail = '+' ( ' ' | eol | tab ) * string
identifier = non_digit ( digit | non_digit ) *
dot_identifier = non_digit ( digit | non_digit ) * ( '.' non_digit ( digit | non_digit ) * ) +
string_identifier = string_identifier

Ignored Tokens

Productions

aif_list =
aif_block *
aif_block =
{actor} actor [trg]:type map_from [src]:type method_expression ? l_bkt attribute_body * r_bkt
| {graph} graph [trg]:type map_from [src]:type method_expression ? l_bkt block * r_bkt
type =
{identifier} identifier
| {dot_identifier} dot_identifier
method_expression =
given_that identifier l_par argument argument_tail * r_par
argument =
{id} identifier
| {value} value
argument_tail =
comma argument
attribute_body =
{mapping} attribute_mapping
| {assign} attribute_assign
attribute_assign =
attribute equal value semicolon
attribute_mapping =
{single} [trg]:attribute map_from [src]:attribute method_expression ? semicolon
| {multi_to_one} attribute map_from attributes semicolon
| {one_to_multi} attributes map_from attribute semicolon
attribute =
name type_expression ?
type_expression =
colon type
attributes =
attribute attribute_tail +
attribute_tail =
comma attribute
block =
{topology} topology topology_body
| {interface} interface interface_body
| {actor} actor name actor_body
name =
{identifier} identifier
| {string_identifier} string_identifier
topology_body =
l_bkt topology_list * r_bkt
topology_list =
{nodes} nodes equal name node_identifier_tail * semicolon
| {edges} edges equal edge_definition edge_definition_tail * semicolon
node_identifier_tail =
comma name
edge_definition =
[edge]:name l_par [source]:name comma [sink]:name r_par
edge_definition_tail =
comma edge_definition
interface_body =
l_bkt interface_expression * r_bkt
interface_expression =
{input} inputs equal port_definition port_definition_tail * semicolon
| {output} outputs equal port_definition port_definition_tail * semicolon
port_definition =
{plain} name port_mapping ?
| {node} [port]:name colon [node]:name port_mapping ?
port_definition_tail =
comma port_definition
port_mapping =
map_from attribute
actor_body =
l_bkt actor_expression * r_bkt
actor_expression =
{value} name type_expression ? equal value semicolon
| {reference} [argument]:name type_expression ? equal [reference]:name semicolon
| {map} name type_expression ? map_from attribute method_expression ? semicolon
| {multi_map} name type_expression ? map_from attributes semicolon
| {reflist} name type_expression ? equal id_list semicolon
id_list =
name ref_id_tail +
ref_id_tail =
comma name
value =
{integer} integer
| {double} double
| {complex} l_par [real]:double comma [imag]:double r_par
| {int_matrix} l_sqr int_row int_row_tail * r_sqr
| {double_matrix} l_sqr double_row double_row_tail * r_sqr
| {complex_matrix} l_sqr complex_row complex_row_tail * r_sqr
| {string} concatenated_string_value
| {boolean} boolean_value
| {array} l_bkt value value_tail * r_bkt
int_row =
integer integer_tail *
integer_tail =
comma integer
int_row_tail =
semicolon int_row
double_row =
double double_tail *
double_tail =
comma double
double_row_tail =
semicolon double_row
complex =
l_par [real]:double comma [imag]:double r_par
complex_row =
complex complex_tail *
complex_tail =
comma complex
complex_row_tail =
semicolon complex_row
concatenated_string_value =
string string_tail *
boolean_value =
{true} true
| {false} false
value_tail =
comma value