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

Cannot build / run tests? #1

Closed
vidstige opened this issue Nov 23, 2016 · 3 comments
Closed

Cannot build / run tests? #1

vidstige opened this issue Nov 23, 2016 · 3 comments

Comments

@vidstige
Copy link
Contributor

Hi,
I would like to add some feature to this awesome project. However, after cloning and running make it gets stuck on this error:

pascal.js vidstige$ make
jison parse.jison
make: jison: No such file or directory
make: *** [parse.js] Error 1

I guess jison needs to be downloaded somehow. I tried npm install to no avail. Doing some research right now to see if I can resolve it.

@vidstige
Copy link
Contributor Author

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.

@kanaka
Copy link
Owner

kanaka commented Nov 23, 2016

@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".

@vidstige
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants