parsifal-47 / sisal-cl

A dialect of Sisal extended with pragmas
MIT License
0 stars 1 forks source link

[Diff from Sisal 3.*] Import of modules is not supported #7

Open datsis opened 4 years ago

datsis commented 4 years ago

Steps to reproduce: 1) Translate following source code to IR:

definition main
uses math, std

function Main(M,N,K : integer returns integer)
    max(M, N+K+1)
end function

Expected result: 1) Successful translation

Actual result:

undefined:6844
      throw peg$buildStructuredError(
      ^
peg$SyntaxError: Expected "function", comment, end of line, or whitespace but "d" found.
    at peg$buildStructuredError (eval at compile (...\sisal-cl\node_modules\pegjs\lib\compiler\index.js:67:29), :688:14)
    at Object.peg$parse [as parse] (eval at compile (...\sisal-cl\node_modules\pegjs\lib\compiler\index.js:67:29), :6844:13)
    at Parser.parse (...\sisal-cl\build\parser.js:11:28)
    at Object. (...\sisal-cl\build\sisal.js:18:36)
    at Module._compile (internal/modules/cjs/loader.js:945:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:962:10)
    at Module.load (internal/modules/cjs/loader.js:798:32)
    at Function.Module._load (internal/modules/cjs/loader.js:711:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1014:10)
    at internal/main/run_main_module.js:17:11 {
  message: 'Expected "function", comment, end of line, or whitespace but "d" found.',
  expected: [
    { type: 'other', description: 'whitespace' },
    { type: 'other', description: 'end of line' },
    { type: 'other', description: 'comment' },
    { type: 'literal', text: 'function', ignoreCase: false }
  ],
  found: 'd',
  location: {
    start: { offset: 0, line: 1, column: 1 },
    end: { offset: 1, line: 1, column: 2 }
  },
  name: 'SyntaxError'
}
datsis commented 4 years ago

Here goes image of IR produced by Sisal 3.* for given source code. A separated "max" node presents imported function. A main function node contains call of "max" function denoted with "call" node receiving a value from "function literal" node of "max' function.

image