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

[BUG REPORT] Function definition allows non-identifiers as parameters

ThomasBollmeier opened this issue · comments

Describe the bug
I am able to define a function with non-identifiers as parameters and run it successfully through the compiler. This results in invalid C code.

To Reproduce
Steps to reproduce the behavior:

  1. Create a simc source file with the following content:
    `fun will_not_compile_in_c(1, 2) {
    return 42
    }

MAIN
var answer = will_not_compile_in_c(41, 1)
END_MAIN`

  1. Compile it with simc

  2. Inspect the generated C file.

Expected behavior
The simc compiler should disallow these kinds of function definitions.

Comment
As I have applied for the feature to add default values for parameters I hopefully can fix this bug along with the feature implementation.

Sure @ThomasBollmeier. Assigning this to you. Thanks @ThomasBollmeier for reporting the bug. Please also link this to #66 too. You can comment on that something like:-

Bug reported - Function definition allows non-identifiers as parameters - #204.

Merged, thanks for your contribution @ThomasBollmeier.