def boolLit(self, node, children): 'boolLit = _("#t" / "#f")_' if (node.text == "#t"): return True else: return False return typecheck.Const(node.text, typecheck.Bool)
def complexLit( self, node, children ): #bit of a mess: complexLit = optional "-", (float or integer), "+" or "-", (float or integer) 'complexLit = ("+"/"-")? (numeral ("." numeral)?) ("+"/"-") (numeral ("." numeral)?) "i"' return typecheck.Const(node.text, typecheck.Complex)
def floatLit(self, node, children): 'floatLit = ("-")? numeral "." numeral ' return typecheck.Const(node.text, typecheck.Float)
def intLit(self, node, children): 'intLit = ("-")? numeral' return typecheck.Const(node.text, typecheck.Int)
def stringLit(self, node, children): 'stringLit = "\\"" ~"[a-z A-Z 0-9 ! # $ ?]*" "\\"" ' return typecheck.Const(node.text, typecheck.String)
def lista(self, node, children): 'lista = "[" expr* "]"' _, arguments, _ = children typos = tsek.parseAndGenerateListType(node.text) return typecheck.Const(str(arguments), typos)
def lista(self, node, children): 'lista = "[" expr* "]"' _, arguments, _ = children return typecheck.Const(str(arguments), typecheck.Qubit)