root/trunk/ProjectFortress/syntax_abstraction_tests/GeneratorClause.fsi

Revision 3412, 2.4 KB (checked in by sukyoungryu, 10 months ago)

[copyright] Fixed copyright notices.

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 GeneratorClause
19    import FortressAst.{...}
20    import FortressSyntax.{...}
21
22    grammar L extends {Expression, Identifier}
23        Expr |:=
24            a:foobar {e:Expr ,? SPACE}* =>
25            case e of
26                Empty => <[ println 0 ]>
27                Cons(fs,bs) =>
28                    <[
29                    do
30                        for x <- 0#(fs asif ZZ32) do
31                            println x
32                            (foobar bs**)
33                        end
34                    end
35                ]>
36            end
37       |  a:goobar {e:Expr ,? SPACE}* =>
38            case e of
39                Empty => <[ println "Empty" ]>
40                Cons(fs,bs) =>
41                    <[
42                    do
43                        var t: Boolean = fs
44                        while x <- t do
45                            t := false
46                            println "Cons"
47                            (goobar bs**)
48                        end
49                    end
50                ]>
51            end
52        |  a:moobar {e:Expr ,? SPACE}* =>
53            case e of
54                Empty => <[ 0 ]>
55                Cons(fs,bs) =>
56                    <[
57                    do
58                        if x <- fs
59                        then 1 + (moobar bs**)
60                        else (moobar bs**)
61                        end
62                    end
63                ]>
64            end
65        |  a:noobar {e:Expr ,? SPACE}* =>
66            case e of
67                Empty => <[ 0 ]>
68                Cons(fs,bs) =>
69                    <[ (SUM [v <- 0:(fs asif ZZ32)] v) + (noobar bs**) ]>
70            end
71
72    end
73end
Note: See TracBrowser for help on using the browser.