root/trunk/ProjectFortress/syntax_abstraction_tests/GrammarComposition.fsi

Revision 3838, 2.0 KB (checked in by sukyoungryu, 6 months ago)

[copyright] Fixed copyright notices of syntactic abstraction tests.

Line 
1(*******************************************************************************
2    Copyright 2009 Sun Microsystems, Inc.,
3    4150 Network Circle, Santa Clara, California 95054, U.S.A.
4    All rights reserved.
5
6    U.S. Government Rights - Commercial software.
7    Government users are subject to the Sun Microsystems, Inc. standard
8    license agreement and applicable provisions of the FAR and its supplements.
9
10    Use is subject to license terms.
11
12    This distribution may include materials developed by third parties.
13
14    Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered
15    trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
16 ******************************************************************************)
17
18api GrammarComposition
19
20    import FortressAst.{...}
21    import FortressSyntax.{...}
22
23    grammar A extends { Expression }
24      Expr |:=
25          foo => <[ 1 ]>
26        | bar => <[ 2 ]>
27    end
28
29    grammar B extends { Expression, A }
30      Expr |:=
31          baz => <[ (foo) + (bar) ]> (* implicit private import from A *)
32    end
33
34    grammar C extends { Expression, A }
35      Expr |:=
36          baz => <[ (foo) + (bar) ]> (* explicit private import from A *)
37        | private Expr from A
38    end
39
40    grammar D extends { Expression, A }
41      Expr |:=
42          baz => <[ (foo) + (bar) ]> (* public import from A *)
43        | Expr from A
44    end
45
46    (* The following grammars test uses of identifiers within
47     * templates. Consequently, they don't have corresponding
48     * .fss source files to test them.
49     *)
50
51    grammar UseC extends { Expression, C }
52      Expr |:=
53          quux => <[ fn(foo) => baz ]> (* illegal if foo were imported *)
54        | private Expr from C
55    end
56
57    grammar UseD extends { Expression, D }
58      Expr |:=
59          quux => <[ fn(x) => ((foo) + (baz)) ]>
60        | private Expr from D
61    end
62
63    grammar RefuseA extends { Expression, A }
64      Expr |:=
65          snark => <[ fn(foo) => foo ]> (* illegal if foo were imported *)
66        | without Expr from A
67    end
68
69end
Note: See TracBrowser for help on using the browser.