hchiam / please

An experimental programming language (transpiler) to make it easier to write code with speech recognition.
MIT License
1 stars 1 forks source link

assigning negative var val minus one to var val --> assigns None #40

Closed hchiam closed 7 years ago

hchiam commented 7 years ago

please assign minus one minus one to variable cow please print variable cow please assign variable cow minus one to variable cow please print variable cow minus one please print variable cow

hchiam commented 7 years ago

Problem identified: Debug printout shows line 3 has cow assigned to None when it should be cow:-3. I think it's that the assign statement is preventing variable name replacement.

Fix identified: change that suppression of variable name replacement for assign statements no longer true but only let it replace before the to keyword.

hchiam commented 7 years ago

Another fix identified: math replacements not recognizing negative numbers.

hchiam commented 7 years ago

Also fix check_variable() to not create new variable names in variable_dictionary when doing assigning.

Now can do:

please assign minus one minus one to variable cow
please print minus one minus one equals variable cow
please assign variable cow minus one to cow
please print cow minus one equals variable cow

--> This outputs:

minus one minus one equals -2
cow minus one equals -3