Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Math-O5 opened this issue Jan 8, 2021 · 0 comments
Labels
bug Something isn't working moderate Moderate problem

Comments

@Math-O5
Copy link
Collaborator

Math-O5 commented Jan 8, 2021

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 Math-O5 added bug Something isn't working moderate Moderate problem SWoC 2021 labels Jan 8, 2021
@Math-O5 Math-O5 self-assigned this Jan 8, 2021
@Math-O5 Math-O5 changed the title [BUG REPORT] [BUG REPORT] Array and variable should not be treat as the same Jan 8, 2021
@Math-O5 Math-O5 changed the title [BUG REPORT] Array and variable should not be treat as the same [FEATURE REPORT] Improvement of arrays: Differentiate array from variables to avoid bugs and check out for ranges when indexing Jan 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working moderate Moderate problem
Projects
None yet
Development

No branches or pull requests

2 participants