elikaski / BF-it

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

[Small Bug] Using an assignment operator which isn't = #37

Closed NeeEoo closed 3 years ago

NeeEoo commented 3 years ago
int y *= 3;

this compiles, but it shouldn't. Other compilers restrict the token after the type to only =, , (this compiler doesn't have this yet), and ;

elikaski commented 3 years ago

Related to #35 Probably somewhere we check if we have "INT ID ASSIGN EXPRESSION" Need to add a check that the ASSIGN's value is = and not other types of assignment (*=, += etc) (Maybe function create_variable_from_definition ? Or maybe in compile_statement before calling compile_expression_as_statement in [INT ID ([NUM])? (= EXPRESSION)? ;]?)