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

Unable to Printf the contents of variables #1

Open
Redrield opened this issue Jun 5, 2017 · 2 comments
Open

Unable to Printf the contents of variables #1

Redrield opened this issue Jun 5, 2017 · 2 comments

Comments

@Redrield
Copy link

Redrield commented Jun 5, 2017

I found this library for your reddit thread, and decided to implement it into a toy language that I'm in the process of making. I was able to make it handle the printing of string literals, but when I tried to abstract it a bit more, I found that it was having trouble emitting code that printed the contents of variables.

My code can be found at https://github.com/Redrield/ChocoLang/blob/experimental/src/main/kotlin/com/redrield/chocolang/codegen/LLVMIRGenerator.kt#L70 (That line is more associated with defining the variables).

I'm not sure if this is user error of if it's a bug in the API, but I wasn't really able to find any documentation past glances in the source, and from what I found that should work.

@ftomassetti
Copy link
Owner

Can you give me more details?

First of all I would need one example of source file you are using so I can try to run the compiler and see what IR code it produces.

@Redrield
Copy link
Author

Redrield commented Jun 6, 2017

The code that I was testing it with is as follows

var x = "Hello"
println(x)

The compiler emits valid java bytecode but the LLVM IR that's emitted produces a mangled output

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