view 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
line wrap: on
line source

#!/usr/bin/env python

import sys

class Translator(object):
    def __init__(self, regexp, cg):
        self.regexp = regexp
        self.cg = cg
        self.stream = None

    def emit(self, string):
        self.stream.write(string)

    def translateFromCallGraph(self):
        pass

    def translate(self, stream=sys.stdout):
        self.stream = stream
        self.translateFromCallGraph()