sim-c icon indicating copy to clipboard operation
sim-c copied to clipboard

[FEATURE] Change implementation of input in parser

Open frankhart2018 opened this issue 4 years ago • 2 comments

Describe the solution you'd like Currently input is considered part of expression function (which makes sense) but when it loses its identity when opcodes are created. For example:-

The simc line - var a = input("Enter a number: ", "i"), produces the opcode - OpCode('var_assign', 'a---Enter a number: ---i', 'int').

If we could add the input to either the type or the value then it would make more sense. It would also help in check_include function in compiler.py which includes stdio.h for inputs, it does so by checking if an opcode's value is split by --- and has a length of 3 or more then it will be an input statement, though this is true for the current implementation but might break in future versions so adding some sense of input to the opcode generated by the parser would help in this step too.

There are minor changes in the compiler loop too.

frankhart2018 avatar Dec 06 '20 13:12 frankhart2018

Hi, can I work on this feature?

sahmed007 avatar Dec 07 '20 02:12 sahmed007

Sure assigning this to you @sahmed007.

frankhart2018 avatar Dec 07 '20 07:12 frankhart2018