LabComm.ast 1.22 KB
Newer Older
1
Specification ::= Decl*;
Anders Nilsson's avatar
Anders Nilsson committed
2

3
4
5
abstract Decl ::= TypeInstance /Signature/;

TypeInstance ::= DataType <Name:String>;
6
7

TypeDecl   : Decl;
Anders Nilsson's avatar
Anders Nilsson committed
8
9
SampleDecl : Decl;

10
11
12
13
14
15
16
17
18
19
20
21
//Signatures are in the abstract grammar, so that
//they can be extended and refined by aspects.

Signature                 ::= SignatureList FlatSignatureList:SignatureList; 
SignatureList             ::= SignatureLine*;
abstract SignatureLine 	  ::= <Indent:int> <Comment:String>; 
abstract DataSignatureLine : SignatureLine;
ByteArraySignatureLine     : DataSignatureLine ::= <Data:byte[]>;
IntSignatureLine           : DataSignatureLine ::= <Data:int>;
StringSignatureLine        : DataSignatureLine ::= <Data:String>;
TypeRefSignatureLine       : SignatureLine     ::= Decl;

22
Field : TypeInstance;
Anders Nilsson's avatar
Anders Nilsson committed
23

24
25
26
27
28
29
30
31
abstract DataType;
VoidType           : DataType;
//SampleRefType      : DataType;
PrimType           : DataType ::= <Name:String> <Token:int>;
UserType           : DataType ::= <Name:String>;
StructType         : DataType ::= Field*;
ParseArrayType     : DataType ::= DataType Dim*;
abstract ArrayType : DataType ::= DataType Exp*;
32
33
VariableArrayType  : ArrayType;
FixedArrayType     : ArrayType;
Anders Nilsson's avatar
Anders Nilsson committed
34
35
36
37
38

Dim ::= Exp*;

abstract Exp;
IntegerLiteral : Exp ::= <Value:String>;
39
VariableSize   : Exp;