Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9251273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:39:17+00:00 2026-06-18T10:39:17+00:00

In the LLVM tutorials there is instruction how to write simple JIT compiler. Unfortunatelly,

  • 0

In the LLVM tutorials there is instruction how to write simple JIT compiler. Unfortunatelly, lexer and parser in this tutorial is written manually. I was thinking, such solution is good for learning purposes but it is not suitable for writing complex, production ready compilers. It seems that GCC and few other “big compilers” are hand written though. But I think, that all these parser generators give a big boost when writing own compiler (especially when youre doing it alone, without team of people).

Is it possible to use any existing parser generator like Bison / Antlr / Packrat / Elkhound etc. together with LLVM to create JIT compiler? I want to be able to “feed” the parser constantly (not once on the beginning) with expressions and compile them in runtime.

Additional I’ve found a lot of questions about “best, modern” parser generator (like this one: https://stackoverflow.com/questions/428892/what-parser-generator-do-you-recommend). If it is possible to use these tools to create LLVM JIT compiler, I would be thankful for any additional hints and recomendation, which tool would be best in terms of performance and flexibility in this particular case.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T10:39:18+00:00Added an answer on June 18, 2026 at 10:39 am

    There are a lot of advantages to using a parser generator like bison or antlr, particularly while you’re developing a language. You’ll undoubtedly end up making changes to the grammar as you go, and you’ll want to end up with documentation of the final grammar. Tools which produce a grammar automatically from the documentation are really useful. They also can help give you confidence that the grammar of the language is (a) what you think it is and (b) not ambiguous.

    If your language (unlike C++) is actually LALR(1), or even better, LL(1), and you’re using LLVM tools to build the AST and IR, then it’s unlikely that you will need to do much more than write down the grammar and provide a few simple actions to build the AST. That will keep you going for a while.

    The usual reason that people eventually choose to build their own parsers, other than the “real programmers don’t use parser generators” prejudice, is that it’s not easy to provide good diagnostics for syntax errors, particularly with LR(1) parsing. If that’s one of your goals, you should try to make your grammar LL(k) parseable (it’s still not easy to provide good diagnostics with LL(k), but it seems to be a little easier) and use an LL(k) framework like Antlr.

    There is another strategy, which is to first parse the program text in the simplest possible way using an LALR(1) parser, which is more flexible than LL(1), without even trying to provide diagnostics. If the parse fails, you can then parse it again using a slower, possibly even backtracking parser, which doesn’t know how to generate ASTs, but does keep track of source location and try to recover from syntax errors. Recovering from syntax erros without invalidating the AST is even more difficult than just continuing to parse, so there’s a lot to be said for not trying. Also, keeping track of source location is really slow, and it’s not very useful if you don’t have to produce diagnostics (unless you need it for adding debugging annotations), so you can speed the parse up quite a bit by not bothering with location tracking.

    Personally, I’m biased against packrat parsing, because it’s not clear what the actual language parsed by a PEG is. Other people don’t mind this so much, and YMMV.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I went through the tutorial to write a toy compiler using LLVM http://llvm.org/releases/3.1/docs/tutorial/ But
I'm working through an LLVM Tutorial , but I'm having trouble compiling. I've written
With Xcode 4.2 and the LLVM compiler, when compiling for ARMv6 there are some
Now we are implementing a analysis pass for llvm , following this tutorial .
There is a tutorial - http://llvm.org/docs/GettingStartedVS.html Example done in pure C. I can compile
I'm currently working on a compiler project using llvm. I have followed various tutorials
I found this: Changing Compiler to llvm-clang on existing iPhone Project But that does
As LLVM compiler with ARC option add retain, copy,release and autorelease for us automatically,
With LLVM and silverlight this may be possible now (or it may be possible
I am writing a LLVM code generator for the language Timber, the current compiler

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.