Relations.relast 1.42 KB
Newer Older
1
2
// do line comments work?

3
Root ::= A* B*;
4
A ::= <Name> /SomeNTA:A/;
5
6
B ::= <Name>;

7
8
9
rel A.Di1  -> B;
rel A.Di2? -> B;
rel A.Di3* -> B;
10

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
  do multiline comments work
*/

/**/

/*
 * work?
*/

/**
 * The root of a Java AST.
 *
 * <p>A Java program consists of multiple compilation units that represent the
 * source files of the program.
 */

28
29
30
rel A.Bi1 <-> B.Bi1;
rel A.Bi2 <-> B.Bi2?;
rel A.Bi3 <-> B.Bi3*;
31

32
33
34
rel A.Bi4? <-> B.Bi4;
rel A.Bi5? <-> B.Bi5?;
rel A.Bi6? <-> B.Bi6*;
35

36
37
38
rel A.Bi7* <-> B.Bi7;
rel A.Bi8* <-> B.Bi8?;
rel A.Bi9* <-> B.Bi9*;
39
40
41
42
43

rel A <- Root.AaLeft?;
rel B <- A.Di1Left ;
rel B <- A.Di2Left?;
rel B <- A.Di3Left*;
44
45
46
47
48
49
50
51

// empty productions
C ;

// production with nonterminals of different kinds
D ::= SingleA:A ListOfA:A* [OptionalA:A] /NTAA:A/ ;

// production with tokens, nonterminal-tokens, multi-line
Johannes Mey's avatar
Johannes Mey committed
52
// there are not Opt-NTAs like /[NT8:A]/ /[A]/
53
E ::= <T1> <T2:String> <T3:boolean> <T4:int> <T5:float> <T6:double> <T7:long>
54
      <T8:java.lang.Object> <T9:ArrayList<String>> <T10:java.util.ArrayList<java.lang.String>>
Johannes Mey's avatar
Johannes Mey committed
55
56
      /<NT1>/ /<NT2:String>/ /<NT3:boolean>/ /<NT4:int>/ /<NT5:float>/ /<NT6:double>/ /<NT7:long>/
      /NT10:A*/ /B*/;
57

Johannes Mey's avatar
Johannes Mey committed
58
rel E.R1 -> A ;
59
60
61
62
63
64
65
66
// inheritance and empty
F : A ;

// inheritance and more on RHS
G : C ::= [D] ;

// line comment with special symbols like |, *, ->, <-, <->, [A], B ::= C, :, \n, \r, ~, #, /A/
/* block comment with special symbols like |, *, ->, <-, <->, [A], B ::= C, :, \n, \r, ~, #, /A/ */