-
-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG REPORT]When printing with variables embedded in strings all occurrences of the variable in the string are converted into format specifier #149
Comments
Thanks @adenashameem for reporting the bug. Please also link this to #66 too. You can comment on that something like:- Bug reported - When printing with variables embedded in strings all occurrences of the variable in the string are converted into format specifier #149. |
I would like to work on this issue, some minor changes will be required, I will suggest a solution for this tomorrow. |
Sure assigning this to you @Saptashrungi. |
I went through the code base, where mapping is done for variables in expression after |
@Saptashrungi |
Yes I went through the |
Yeah :) |
I am facing a problem in debugging, even after commenting out or change a significant part of code in simc_parser.py , I get same opcode. |
Yes |
@frankhart2018 @Saptashrungi This issue should be closed? |
Yeah this is merged. |
Yes it's fixed. |
Describe the bug
When using the syntax provided for printing with variables embedded in strings, each and every occurrence of that variable even in the string part is converted into a format specifier, however only the occurrence of the variable after the '=' sign should be converted into a format specifier.
To Reproduce
Steps to reproduce the behavior:
simC code:
MAIN
var a_var = 42
print("The value of a_var = {a_var}")
END_MAIN
C code the above simC code generates right now:
#include <stdio.h>
int main() {
int a_var = 42;
printf("The value of %d = %d", a_var);
}
This C code gives the output:
The value of 42 = 10109280
Expected behavior
Expected C code:
#include <stdio.h>
int main() {
int a_var = 42;
printf("The value of a_var = %d", a_var);
}
Expected Output:
The value of a_var = 42
Desktop:
The text was updated successfully, but these errors were encountered: