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

[FEATURE REPORT] Improvement of arrays: Differentiate array from variables to avoid bugs and check out for ranges when indexing

Open Math-O5 opened this issue 3 years ago • 0 comments

Describe the feature This would be extension of #346, #354 and #344. Arrays are treat as variables and therefore, can be freely used as one.

To Reproduce We are not differentiating variables from array, so the code where we sum two variables, as example, can be in fact two arrays!

Sim-C:

   var b[10]
   b[0] = 1
   // All line following should throw an error, but it does not!
   c = b[b] 
   d = b * 2 + b 
   e[10]
   e[b + b] = 10
   f = e[b + b] 

Expected behavior We should add another metadata type for array and one filed more in the Symbol Table, then add a case on expression function in simc_parser.py to know if we are indexing the array 'b[x]' or using it raw without indexing!

Desktop (please complete the following information):

  • OS: Fedora 30.0.x

Additional context Start this issue only if you look at CONTRIBUTING.md file

Math-O5 avatar Jan 08 '21 01:01 Math-O5