-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtokenizer.py
More file actions
41 lines (31 loc) · 911 Bytes
/
tokenizer.py
File metadata and controls
41 lines (31 loc) · 911 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""
"""
def tokenize(source):
"""
Splits the input string into meaningful tokens.
@params
source : a string containing the source code of a
Scheme expression
"""
white_space = {" ", "\n"}
parentheses = {"(" , ")"}
token_list = []
return None
def recursiveTokenizer(sub_source, token = "", tokens = []):
"""
Recursively populates the tokens_list using
arguments from the source passed when calling tokenize
@params
sub_source : a string containing a subset of the
original Scheme expression
token : the cumulatively grown token to be added
to the token list
@returns a populated list of tokens
"""
if not sub_source:
if token != "":
tokens.append(token)
return tokens
next_element = sub_source[0]
if next_element == ";":
pass