summaryrefslogtreecommitdiff
path: root/tnslc/compile/generator.tnsl
blob: eedc552463a9dbd6c59f666f198abb3902be088d (plain)
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

~uint8 TOKEN_COUNT = "Token count: %d\n\0"

/; generate (~utils.File fin, fout)

	utils.Vector tokens = tokenize(fin)

	_print_num(TOKEN_COUNT, tokens.count)

	fout`.create()

	/; loop (int i = 0; i < tokens.count) [i++]
		~Token tok = tokens.get(i)
		~uint8 buf = tok`.sprint()
		fout`.write_cstr(buf)
		fout`.write('\n')
		_delete(buf)
	;/

	fout`.close()

	free_token_list(~tokens)

;/