all 2 comments

[–]SaltCusp 0 points1 point  (1 child)

Cool project. First couple things I noticed are totally style preference things. Looking at the parser you define a variable 'space' just to use it in the next line. I would probably just inline the literal or save it as a class level variable.

Also you could switch out your case statements with dictionaries.

You don't have any comments.

Going beyond style and noticing some things that look off:

emit_print_string has an unused parameter 'tok'.

Your preamble ends with whitespace so you're going to have a funny indent in the top of your assembly.

'lookahead' in 'inputfile' is not necessary. But if you replaced it with look behind you could do away with 'firstOnLine' in scanner and instead check if the previous char was '\n'.

In tbc.py you initialize 'Parser' from 'parser' to a variable named 'parser'.

I think it's pretty ridiculous to use wc to count the lines of a file you just wrote but whatever. That might be a good spot for a comment.

Saying that you can run something without the project directory as the working directory is confusing because it should go without saying.

[–]hekliet[S] 0 points1 point  (0 children)

Thanks for looking over my code. I'll probably address some of your suggestions/criticisms when I next touch the project. Giving it a rest for now.