Code Monkey home page Code Monkey logo

Comments (9)

414owen avatar 414owen commented on June 12, 2024 1

@FoamScience I ran your setup in a debugger, and this is where the error occured.

Screenshot from 2022-01-06 15-45-20

I've gone into the surrounding code and I'm 80% this will be fixed by adding memset in the same way as this pr.

There was a point at which it was looking up memset in a dict of the symbols we've marked as exported.

Why exactly it manifests in this way, I have no idea...

@wenkokke did you have to do anything special to get the nice undefined symbol errors?

edit I guess it's slightly different, it can't find memset, rather than _memset

from tree-sitter-haskell.

wenkokke avatar wenkokke commented on June 12, 2024 1

Yes, compile web-tree-sitter with the —debug flag.

from tree-sitter-haskell.

414owen avatar 414owen commented on June 12, 2024

tree-sitter-haskell no longer requires c++14, only c99. See this pr.
I've also added all required symbols to the WASM export.

Can you upgrade tree-sitter-haskell?
If not, is it because the npm pakage needs updating? There's an issue for that. #50

from tree-sitter-haskell.

wenkokke avatar wenkokke commented on June 12, 2024

It won't work until the latest tree-sitter is released. Until then, you can use the version in #68.

from tree-sitter-haskell.

FoamScience avatar FoamScience commented on June 12, 2024

Yes, I've seen the pure-c jump; I asked because I'm having similar problems with WASM files for my own language (was using a c++14 scanner library myself)
I think the best option for me is to revert back to C too 😄 Thanks!

from tree-sitter-haskell.

414owen avatar 414owen commented on June 12, 2024

C is the most portable language :)

from tree-sitter-haskell.

FoamScience avatar FoamScience commented on June 12, 2024

OK, I think I'm in a much better position with the C-scanner;
I'm generating WASM files for my language with this CI workflow (please note that it's building the pure_c_scanner branch)

Then, to test the generated WASM file:

const Parser = require('web-tree-sitter');

(async () => {
  await Parser.init();
  const parser = new Parser();
  const Lang = await Parser.Language.load(`${__dirname}/languages/foam.wasm`);
  parser.setLanguage(Lang);
  const tree = parser.parse('wm 1;');
  console.log(tree.rootNode.toString());
})();

BTW, no errors with any other WASM file (for cpp, haskell ... etc) just mine :(

Node errors out with:

(node:191242) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'apply' of undefined
    at e.<computed> (/home/elwardi/repos/foamParser/node_modules/web-tree-sitter/tree-sitter.js:1:10542)
    at tree_sitter_foam_external_scanner_scan (<anonymous>:wasm-function[11]:0xa1b)
    at ts_parser_parse_wasm (<anonymous>:wasm-function[214]:0x22e29)
    at Object.Module._ts_parser_parse_wasm (/home/elwardi/repos/foamParser/node_modules/web-tree-sitter/tree-sitter.js:1:20097)
    at Parser.parse (/home/elwardi/repos/foamParser/node_modules/web-tree-sitter/tree-sitter.js:1:35112)
    at /home/elwardi/repos/foamParser/test-wasm.js:8:23

Which suggests something is wrong with tree_sitter_foam_external_scanner_scan which is just a copy of yours.

I know very little about WebAssembly, but my WASM files and Haskell's are not much different so I can't really tell what's the problem.
Any idea on what might be the cause of this thing? Any kind of help is much appreciated

from tree-sitter-haskell.

414owen avatar 414owen commented on June 12, 2024

@FoamScience On my machine, when I run tree-sitter build-wasm and then run your node file (with paths updated), I get Error: bad export type for _ZNSt3__25ctypeIcE2idE: undefined. Not sure if that's a step forward, or backward...

from tree-sitter-haskell.

FoamScience avatar FoamScience commented on June 12, 2024

@FoamScience On my machine, when I run tree-sitter build-wasm and then run your node file (with paths updated), I get Error: bad export type for _ZNSt3__25ctypeIcE2idE: undefined. Not sure if that's a step forward, or backward...

Yep, you're using the master branch which still needs C++14, please try pure_c_scanner

from tree-sitter-haskell.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.