~ubuntu-branches/ubuntu/warty/bnfc/warty

« back to all changes in this revision

Viewing changes to AbsBNF.hs

  • Committer: Bazaar Package Importer
  • Author(s): Antti-Juhani Kaijanaho
  • Date: 2004-05-02 22:56:44 UTC
  • Revision ID: james.westby@ubuntu.com-20040502225644-xs7k4eyj02c0f6rh
Tags: upstream-2.1.2
ImportĀ upstreamĀ versionĀ 2.1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{-
 
2
    BNF Converter: Abstract syntax
 
3
    Copyright (C) 2004  Author: BNF Converter
 
4
 
 
5
    This program is free software; you can redistribute it and/or modify
 
6
    it under the terms of the GNU General Public License as published by
 
7
    the Free Software Foundation; either version 2 of the License, or
 
8
    (at your option) any later version.
 
9
 
 
10
    This program is distributed in the hope that it will be useful,
 
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
    GNU General Public License for more details.
 
14
 
 
15
    You should have received a copy of the GNU General Public License
 
16
    along with this program; if not, write to the Free Software
 
17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
-}
 
19
 
 
20
 
 
21
module AbsBNF where
 
22
 
 
23
-- Haskell module generated by the BNF converter
 
24
 
 
25
newtype Ident = Ident String deriving (Eq,Ord,Show)
 
26
data Grammar =
 
27
   Grammar [Def]
 
28
  deriving (Eq,Ord,Show)
 
29
 
 
30
data Def =
 
31
   Rule Label Cat [Item]
 
32
 | Comment String
 
33
 | Comments String String
 
34
 | Internal Label Cat [Item]
 
35
 | Token Ident Reg
 
36
 | Entryp [Ident]
 
37
 | Separator MinimumSize Cat String
 
38
 | Terminator MinimumSize Cat String
 
39
 | Coercions Ident Integer
 
40
 | Rules Ident [RHS]
 
41
 | Layout [String]
 
42
 | LayoutStop [String]
 
43
 | LayoutTop
 
44
  deriving (Eq,Ord,Show)
 
45
 
 
46
data Item =
 
47
   Terminal String
 
48
 | NTerminal Cat
 
49
  deriving (Eq,Ord,Show)
 
50
 
 
51
data Cat =
 
52
   ListCat Cat
 
53
 | IdCat Ident
 
54
  deriving (Eq,Ord,Show)
 
55
 
 
56
data Label =
 
57
   Id Ident
 
58
 | Wild
 
59
 | ListE
 
60
 | ListCons
 
61
 | ListOne
 
62
  deriving (Eq,Ord,Show)
 
63
 
 
64
data RHS =
 
65
   RHS [Item]
 
66
  deriving (Eq,Ord,Show)
 
67
 
 
68
data MinimumSize =
 
69
   MNonempty
 
70
 | MEmpty
 
71
  deriving (Eq,Ord,Show)
 
72
 
 
73
data Reg =
 
74
   RSeq Reg Reg
 
75
 | RAlt Reg Reg
 
76
 | RMinus Reg Reg
 
77
 | RStar Reg
 
78
 | RPlus Reg
 
79
 | ROpt Reg
 
80
 | REps
 
81
 | RChar Char
 
82
 | RAlts String
 
83
 | RSeqs String
 
84
 | RDigit
 
85
 | RLetter
 
86
 | RUpper
 
87
 | RLower
 
88
 | RAny
 
89
  deriving (Eq,Ord,Show)
 
90