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

simc fails to add reference address when input is not specified with data type

Chasmiccoder opened this issue · comments

Description of the Bug
According to the documentation, if the test.simc file contains an input line like this:
var a = input( )
Then, the type selected will be string. However, during compilation, the test.c file does not accept the input successfully.

To Reproduce the Bug
Steps to reproduce the behavior:

  1. In test.simc, write the line: var a = input( )
  2. Run the simc compiler to create test.c
  3. In test.c go over to the scanf( ) statement generated by the corresponding input( ) line of code.
  4. See error. After compilation, the compiler uses a as an argument to scanf( ) instead of using &a.

Expected behavior
The compiler should add an & symbol before the variable.

Screenshots
According to the Documentation:
image

The .simc program statement:
image

After compilation (when .c file is created):
image

This is why the program crashes whenever input( ) is used without specifying the data type.

Desktop:

  • OS: Windows 10, VS Code

Seems to be a duplicate of #183. Closing this.