Created
April 23, 2016 17:08
-
-
Save cwgreene/cb29468bc7243c5ed5a1e43d01dfff59 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
array = [] | |
class Token(): | |
def __init__(self, input): | |
if input[0].isdigit: | |
self.type = "INT" | |
self.value = int(input) | |
else: | |
self.type = "STRING" | |
self.value = input | |
def main(): | |
afile = open(sys.argv[1]).read() | |
res = afile.split() | |
for token in res: | |
if token: | |
array.append(Token(token)) | |
for a in array: | |
print a.type, a.value | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment