elikaski / BF-it

A C-like language to Brainfuck compiler, written in Python
MIT License
121 stars 11 forks source link

Small Improvements #31

Closed NeeEoo closed 3 years ago

NeeEoo commented 3 years ago

Fixed some PyCharm warnings.

NeeEoo commented 3 years ago

Is it okay if i update this pr so it also includes bf code algorithm improvements.

NeeEoo commented 3 years ago

Can we assume that the compiler and interpreter will always use 8 bit cells?

NeeEoo commented 3 years ago

Before you merge is it okay if i include some optimizations to some of the bf code. Such as >, <, >=, <= and improvements to get_set_cell_value_code so it returns even more optimized code, saving 1-4 bytes on some numbers.

elikaski commented 3 years ago

Is it okay if i update this pr so it also includes bf code algorithm improvements.

Please do it in a separate pull request :)

Can we assume that the compiler and interpreter will always use 8 bit cells?

There is no standard to cell size and wrap around property... but 8 bit and wrap around is common. I would prefer not to assume the cell size, but if you have a good reason then it might be a OK :)

Before you merge is it okay if i include some optimizations to some of the bf code. Such as >, <, >=, <= and improvements to get_set_cell_value_code so it returns even more optimized code, saving 1-4 bytes on some numbers.

Please do it in a separate pull request :)

Thanks again for all your help! Much appreciated

NeeEoo commented 3 years ago

Ok I'll separate the the large bf code improvements into a separate pull request, and only push the small improvements in this one.

The cell size was more due to me wanting to make get_set_cell_value_code return [-]- for 255, but I see your reasoning and will make it so it doesn't assume the cell size.

NeeEoo commented 3 years ago

@elikaski Hey, I was wondering if you could review the changes, so I can make another pull request with the changes I talked about before.

Since merge conflicts are annoying.

elikaski commented 3 years ago

@elikaski Hey, I was wondering if you could review the changes, so I can make another pull request with the changes I talked about before.

Since merge conflicts are annoying.

Hey, sorry for the late reply, I've been busy lately (check out my new repository ;)) I reviewed your changes and it looks like you did a really good job! Both the cosmetic part and the BrainFuck optimization! I would like to thank you again :)