Sudakshina Dutta via llvm-dev
2021-Apr-02 12:45 UTC
[llvm-dev] Kaleidoscope code example error
Dear all, Good day to you. I was trying to subject some sample input code to Kaleidoscope code (given in https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/index.html). However, as I subject the following code segment (given in https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/LangImpl01.html) to the kaleidoscope executable # Compute the x'th fibonacci number.def fib(x) if x < 3 then 1 else fib(x-1)+fib(x-2) # This expression will compute the 40th number.fib(40) the following errors are shown. ready> ready> Error: Unknown variable name ready> Error: Unknown variable name ready> Error: Unknown variable name ready> Read top-level expression: define double @__anon_expr() { entry: ret double 1.000000e+00 } ready> Error: Unknown variable name ready> Error: Unknown function referenced Error: Unknown function referenced ready> ; ModuleID = 'my cool jit' source_filename = "my cool jit" Can somebody kindly help ? Thanks a lot. Sudakshina -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210402/a8a1e392/attachment.html>
David Blaikie via llvm-dev
2021-Apr-02 20:09 UTC
[llvm-dev] Kaleidoscope code example error
Perhaps you're trying to run that fib example in noe of the early chapters (like chapter 1) - it's only going to work once you're a few chapters in - I think at least around chapter 5, which provides control flow ('if'/'else'). On Fri, Apr 2, 2021 at 5:45 AM Sudakshina Dutta via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > Dear all, > > Good day to you. I was trying to subject some sample input code to Kaleidoscope code (given in https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/index.html). However, as I subject the following code segment (given in https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/LangImpl01.html) to the kaleidoscope executable > > # Compute the x'th fibonacci number. > def fib(x) > if x < 3 then > 1 > else > fib(x-1)+fib(x-2) > > # This expression will compute the 40th number. > fib(40) > > the following errors are shown. > > ready> ready> Error: Unknown variable name > ready> Error: Unknown variable name > ready> Error: Unknown variable name > ready> Read top-level expression: > define double @__anon_expr() { > entry: > ret double 1.000000e+00 > } > > ready> Error: Unknown variable name > ready> Error: Unknown function referenced > Error: Unknown function referenced > ready> ; ModuleID = 'my cool jit' > source_filename = "my cool jit" > > Can somebody kindly help ? > > Thanks a lot. > > Sudakshina > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev