#Scanner created with HexNumber.ATG data from AFDFixed.AFD import * adfArray = [] ident = 'ident' temp = AFD(ident) tempidentAcceptance = {0: False, 1: True} temp.setDictAcceptance(tempidentAcceptance) tempidentTransitions = { 0: { 1: [{ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122 }] }, 1: { 1: [{ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122 }, {48, 49, 50, 51, 52, 53, 54, 55, 56, 57}] } } temp.setTransition(tempidentTransitions) adfArray.append(temp) hexnumber = 'hexnumber'
tokensDict, exceptions = createTokensDict(charactersDict, tokens, specialCharacters, special) print('tokensDict', tokensDict) tokensArray = functionsCreator(tokensDict, charactersDict) for i in tokensArray: print(i.getTransitions()) i.correctTransitions(charactersDict, specialCharacters, special) print(i.getTransitions()) adfArray = [] for i in tokensArray: name = i.getName() temp = AFD(name) acceptanceDict = i.getAcceptance() temp.setDictAcceptance(acceptanceDict) transitionsDict = i.getTransitions() temp.setTransition(transitionsDict) adfArray.append(temp) exceptions = ['while', 'do', 'if', 'switch'] scanner = fileWritter(nameATG) scanner.writeImport('from AFDFixed.AFD import *') scanner.writeSentence('') scanner.writeSentence("exceptions = ['while','do','if','switch']") adfArray = [] scanner.writeSentence('adfArray = []') for i in tokensArray: name = i.getName() scanner.addString(name, name)
#Scanner created with Aritmetica.ATG data from AFDFixed.AFD import * exceptions = ['while', 'do', 'if', 'switch'] adfArray = [] ident = 'ident' temp = AFD(ident) tempidentAcceptance = {0: False, 1: True} temp.setDictAcceptance(tempidentAcceptance) tempidentTransitions = { 0: { 1: [{ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122 }] }, 1: { 1: [{ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122 }, {48, 49, 50, 51, 52, 53, 54, 55, 56, 57}] } } temp.setTransition(tempidentTransitions) adfArray.append(temp)
#Scanner created with Double.ATG data from AFDFixed.AFD import * exceptions = ['while', 'do', 'if', 'switch'] adfArray = [] number = 'number' temp = AFD(number) tempnumberAcceptance = {0: False, 1: True} temp.setDictAcceptance(tempnumberAcceptance) tempnumberTransitions = { 0: { 1: [{48, 49, 50, 51, 52, 53, 54, 55, 56, 57}] }, 1: { 1: [{48, 49, 50, 51, 52, 53, 54, 55, 56, 57}] } } temp.setTransition(tempnumberTransitions) adfArray.append(temp) decnumber = 'decnumber' temp = AFD(decnumber) tempdecnumberAcceptance = {0: False, 1: False, 2: False, 3: True} temp.setDictAcceptance(tempdecnumberAcceptance) tempdecnumberTransitions = { 0: { 1: [{48, 49, 50, 51, 52, 53, 54, 55, 56, 57}] }, 1: {
#Scanner created with Cocol.ATG data from AFDFixed.AFD import * exceptions = ['while', 'do', 'if', 'switch'] adfArray = [] ident = 'ident' temp = AFD(ident) tempidentAcceptance = {0: False, 1: True} temp.setDictAcceptance(tempidentAcceptance) tempidentTransitions = { 0: { 1: [{ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122 }] }, 1: { 1: [{ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122 }, {48, 49, 50, 51, 52, 53, 54, 55, 56, 57}] } } temp.setTransition(tempidentTransitions) adfArray.append(temp)