cimplec / sim-c

A dynamically typed high-level front end for C

Home Page:https://cimplec.github.io/docs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FEATURE] Change implementation of input in parser

frankhart2018 opened this issue · 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.

Hi, can I work on this feature?

Sure assigning this to you @sahmed007.