Giter VIP home page Giter VIP logo

Comments (3)

vidstige avatar vidstige commented on August 14, 2024

Ok, fixed the build in #2. I can now run parse.js to get an AST by issuing node parse.js examples/hello.pas. Where do I go from here? Thanks.

from pascal.js.

kanaka avatar kanaka commented on August 14, 2024

@vidstige I updated the README with a bit more information about how to use the code including how to generate JavaScript. The JavaScript output works, however, LLVM/clang IR format has changed since I wrote this (specifically the getelementptr keyword). For example:

$ node compile_native.js tests/ffib.pas build/ffib
.../pascal.js/compile_native.js:17
        throw new Error("Errors during compilation:\n" + stderr);
        ^

Error: Errors during compilation:
llc-3.8: <stdin>:5:72: error: expected comma after getelementptr's type
@BOOLEAN_0_ = global [2 x i8*] [ i8* getelementptr inbounds ([6 x i8]* @BOOLEAN_0_.FALSE_1_, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8]* @BOOLEAN_0_.TRUE_3_, i32 0, i32 0) ]
                                                                       ^

    at .../pascal.js/compile_native.js:17:15
    at ChildProcess.exithandler (child_process.js:218:5)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:885:16)
    at Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:501:12)

This means that the IR being generated by ir.js is no longer compatible with recent versions of clang/LLVM. I'm not going to have time to debug this myself, but I would be happy to accept a fix if you want to track it down. There may be other problems apart from the getelementptr issue, but for that one I would start here:

Oh, and make sure you either have an executable named llc or change the LLC variable in compile_native.js to point to you llc executable. For example, on Ubuntu 16.10 with clang installed, I change the LLC variabled to "llc-3.8".

from pascal.js.

vidstige avatar vidstige commented on August 14, 2024

Worked like a charm, got some fibonacci numbers printed in my terminal here. I'm on mac though, and not so interested in native anyway. Thanks for your quick help. 👍 I will try to see if I can get this to build in travis ci as well.

from pascal.js.

Related Issues (4)

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.