-
Notifications
You must be signed in to change notification settings - Fork 229
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
Documention #2
Comments
I'm currently working on the Kaleidoscope tutorial using Inkwell, and I think it would make a great self-documenting example. Any chance this would get added to the repo, once it fully works? |
Definitely! I was actually thinking the same thing. I just cant decided if it should be a test or if it should live as its own binary in a /examples directory. The former has the advantage of being run in every build, so we can easily ensure it compiles every time. But the latter has the advantage of being more easily noticeable when someone is browsing the repo or root directory. They can also build it themselves and try it out if we add a simple CLI. For reference, the example in the readme is also duplicated as a test but I think it's small enough that it isn't a big deal. A Kaleidoscope example would be much larger, for sure. I will add Kaleidoscope to the checklist in the original post. |
I think living in the /examples directory is definitely a plus. Furthermore, I'm actually almost done with the first three chapters of the tutorial: the basic lexer, parser, and compiler are more-or-less working. |
Oh neat, I didn't know that. Let's do that then. You can put it in /examples/kaleidoscope |
Are there any plans on getting Travis to upload docs for As an example, this is what we've got set up for |
No, I've never even thought about doing this as I am not really familiar with how github pages work. That said, it does sound like an excellent idea, so thanks! I'll add it to the above checklist and try and prioritize it. So if I understand correctly, you're basically committing the docs from Could you also clarify how it would make importing inkwell from git easier? |
Yep. Essentially everything in the I recently found out Travis made the process even easier by adding the GitHub Pages provider. deploy:
provider: pages
skip-cleanup: true
github-token: $GITHUB_TOKEN # Set in travis-ci.org dashboard, marked secure
keep-history: false # this tends to really bloat your .git directory with useless docs churn
local-dir: target/doc/
on:
branch: master
Having access to an online version of the docs is useful when you need to link to things or want to browse the docs without needing to run That said, this looks like a really cool! I'll try it out for a toy programming language I've been making in my spare time and see if there's anything I can do to help out. |
Thanks for all this helpful info! I will be sure to look into doing this! And any assistance you can provide would be greatly appreciated. |
I thought I'd make a more in-depth guide to using inkwell for making programming languages. It's not as simple as @6a's kaleidoscope example (I want to briefly mention parsing with lalrpop and linking to C libraries), but it'll probably serve as a good example of how to use inkwell in a wider program. Depending on how far I get, it may be a useful link to add to inkwell's README. |
That is super cool! Please feel free to file issues for any stumbling blocks you find along the way. |
Oh, that's great! I hope you manage to get FFI through LLVM working, because I didn't manage to using the recommended methods. |
I've finished the parsing section so next up is the fun part... Generating LLVM IR 😁 Do you guys have any suggestions for turning an AST into a LLVM |
I went with a monolithic block of code because I stored expressions under a single enum, but if you're doing this differently you could go with the Visitor pattern, which splits the code gen into multiple functions. Update: Looks like that's what you went with. You could still go with a single function and a match to take care of it, since your language is much simpler than the kaleidoscope one. Throwing out the if-then-else expression and for-in statements would make the |
Another important point that should be documented is
|
I also like enabling several lints on my projects, the #![deny(missing_docs,
missing_debug_implementations, missing_copy_implementations,
trivial_casts, trivial_numeric_casts,
unsafe_code,
unstable_features,
unused_import_braces, unused_qualifications)] |
Yes, in Inkwell it is safe to do so because we ref count non global
I don't know. I think LLVM does a lot of different and weird things. I'm sure they do use
As best as I've been able to tell, types and values are sort of LLVM singletons, but owned by a context, IIRC they don't segfault if you drop that Context though (we should test this if we don't already...) and try to use them
Not sure without seeing code. It would be great if you could open an issue with a sample of code that replicates the segfault. But yeah - this would ideally be encoded into the type system |
@Michael-F-Bryan I'm trying to get docs hosted on pages as you suggested but for some reason it only displays the inkwell readme: https://thedan64.github.io/inkwell/ ..but the gh-pages branch doesn't have a readme just the inkwell docs: https://github.com/TheDan64/inkwell/tree/gh-pages Any ideas? I'm a bit at a loss here |
That was it, thanks!! |
@Michael-F-Bryan Docs are hosted here though they only show the latest LLVM version since there's a flaw in rustdoc regarding documenting multiple conflicting features. rust-lang/rust#43781 might work but it's not yet stable, and I don't wish to make inkwell nightly for just that. Thanks again for the suggestion! |
If you want, I can help by writing some docs, since I've been using this library a lot. Tell me what needs documenting most and I'll submit a pull request. |
Thanks for offering to help! Feel free to pick anything from the list in the OP. The files in the |
I've found the easiest way to do this sort of thing is by adding |
Hey, I have been looking through the documentation for quite a while now and I just can’t find any about lazy JIT-compilation. Is there any available or can lazy JIT-compilation be implemented using this wrapper library? Thanks, |
I don't believe the LLVM C API supports any lazy JIT. Unless you mean Orc JIT - I do see |
Yes I do mean Orc JIT and I think it's an important part of LLVM as JIT compiling everything in advance (including sections that are not even used) is extremely inefficient. So to what extend is it already useable in inkwell? |
Are there any plans to improve support soon? |
Hi, I really need the ORC layer for my project and I think it's also quite an important feature. Should I create an issue so that people actually notice that this is still work to be done? |
Unfortunately I do not currently have the free time to implement additional ORC support. I would certainly be willing and able to accept PRs which improve the existing implementation and add additional tests |
Upgrade inkwell so we can use debug info
Yes, do you know which crate would be better to use when on-request compilation is desired? Is only @TheDan64 Btw, for a use case where on-request compilation is not required, but it is required to link a pre-compiled |
I'm also looking for a similar library for rust |
@Boscop I'm not sure unfortunately. But if it's possible in the llvm C API we should be able to do it in inkwell Please all, let's keep this thread on topic to documentation. Please feel free to create a question issue if there isn't already one for this matter |
The text was updated successfully, but these errors were encountered: