comparison src/translator.py @ 6:168d60b03e2c

add dotTranslator(Translator), that can translate from DFA or NFA into Dot-file(Dot is graph generater using tex.)
author ryoma <shinya@firefly.cr.ie.u-ryukyu.ac.jp>
date Fri, 02 Jul 2010 02:43:28 +0900
parents 11fba907c0af
children a28f87d353bb
comparison
equal deleted inserted replaced
5:11fba907c0af 6:168d60b03e2c
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 import sys 3 import sys
4 4
5 class Translator(object): 5 class Translator(object):
6 def __init__(self, regexp, cg, stream=sys.stdout): 6 def __init__(self, regexp, cg):
7 self.regexp = regexp 7 self.regexp = regexp
8 self.cg = cg 8 self.cg = cg
9 self.stream = stream 9 self.stream = None
10 10
11 def emit(self, string): 11 def emit(self, string):
12 self.stream.write(string) 12 self.stream.write(string)
13 13
14 def translateFromCallGraph(self): 14 def translateFromCallGraph(self):