Subversion Repositories programming

Rev

Rev 228 | Rev 231 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 228 Rev 229
Line 1... Line 1...
1
/*******************************************************************************
1
/*******************************************************************************
2
 * File: jminus.y
2
 * File: jminus.y
3
 * 
3
 * 
4
 * Copyright (c) 2006, Ira W. Snyder (devel@irasnyder.com)
4
 * Copyright (c) 2006, Ira W. Snyder (devel@irasnyder.com)
5
 * License: GNU General Public License v2
5
 * License: GNU General Public License v2
6
 * 
6
 *
-
 
7
 * This file contains a definition of the J-Minus language, and will
-
 
8
 * create a parser for the language when compiled using BYACC/J, which
-
 
9
 * is available from http://byaccj.sourceforge.net.
7
 ******************************************************************************/
10
 ******************************************************************************/
8
 
11
 
9
%{
12
%{
10
    import java.lang.*;
13
    import java.lang.*;
11
    import java.io.*;
14
    import java.io.*;
Line 32... Line 35...
32
%token LBRACE
35
%token LBRACE
33
%token RBRACE
36
%token RBRACE
34
%token SEMI
37
%token SEMI
35
%token ASSIGNOP
38
%token ASSIGNOP
36
 
39
 
37
/* JMinus Grammar */
40
/* J-Minus Grammar */
38
%%
41
%%
39
program : modifier CLASS ID LBRACE method_declaration RBRACE
42
program : modifier CLASS ID LBRACE method_declaration RBRACE
40
        { System.out.println ("program -> modifier class id { method_declaration }"); };
43
        { System.out.println ("program -> modifier class id { method_declaration }"); };
41
 
44
 
42
modifier : PUBLIC   { System.out.println ("modifier -> public"); }
45
modifier : PUBLIC   { System.out.println ("modifier -> public"); }