view pyrect/cbc_translator.py @ 43:83c69d42faa8

replace converting-flow, module dfareg with module regexp. it's is substantial changing in implimentation.
author Ryoma SHINYA <shinya@firefly.cr.ie.u-ryukyu.ac.jp>
date Tue, 03 Aug 2010 05:35:38 +0900
parents 50b10929be29
children d29d3470fde7
line wrap: on
line source

#!/usr/bin/env python

from pyrect.regexp import Regexp
from pyrect.c_translator import CTranslator

class CbCTranslateExeption(Exception):
    pass

class CbCTranslator(CTranslator):
    """
    CbCTranslator
    >>> string = \"(A|B)*C\"
    >>> reg = Regexp(string)
    >>> ct = CbCTranslator(reg)
    >>> ct.translate()
    >>> ct.debug = True
    >>> ct.translate()
    """
    def __init__(self, regexp):
        CTranslator.__init__(self, regexp)
        self.funType = '__code '
        self.callType = 'goto '
        self.breakStatement = ''

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__' : test()