Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • sac2c sac2c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 401
    • Issues 401
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 13
    • Merge requests 13
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Issues
  • #2253
Closed
Open
Created Nov 24, 2020 by Artem Shinkarov@temaOwner

Parser being too smart with fold expressions

/tmp|=> cat test-fold.sac 
int main () {
  a = [1,2,3];
  return with {
    ([0] <= iv <= _shape_A_ (a)): _sel_VxA_ (iv, a);
  }: fold (_add_SxS_, 0);
}
/tmp|=> ./sac2c/build_d/sac2c_d test-fold.sac
**  1: Loading SAC program ...
  **** Locating source code ...
  Reading from file "./test-fold.sac" ...
  **** Running C preprocessor ...
  **** Parsing input file ...
./test-fold.sac:5:12: error: 
=> invalid function name `_add_SxS_' found
./test-fold.sac:7:1: error: 
=> token `}' expected, `EOF' token found
abort: Failed to construct a syntax tree for `test-fold.sac'
compilation failed while Loading SAC program, 2 error(s).

The problem is that parser expects an identifier, but _add_SxS_ is a keyword, hence the error. This can be trivially fixed, given that the backend is happy to accept primitive function as a valid object. The question is: what should SPFOLD_FN be in this case? SPID or PRF?

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking