Added a very rudimentary fur-to-c compiler
[fur] / main.py
1 import sys
2
3 import generation
4 import parsing
5 import tokenization
6 import transformation
7
8 source_path = sys.argv[1]
9
10 with open(source_path, 'r') as f:
11     source = f.read()
12
13 tokens = tokenization.tokenize(source)
14 parsed = parsing.parse(tokens)
15 transformed = transformation.transform(parsed)
16 generated = generation.generate(transformed)
17
18 assert source_path.endswith('.fur')
19 destination_path = source_path[:-4] + '.c'
20
21 with open(destination_path, 'w') as f:
22     f.write(generated)