Jump to content
  • Advertisement
  • entries
  • comments
  • views

Epoch self-hosting progress

Sign in to follow this  


So the Epoch compiler is now written end-to-end in Epoch. There is no C++ left in the bootstrapping process aside from the runtime environment which does garbage collection and such.

Sadly this doesn't mean that we're quite to self-hosting just yet. Only about a third of the compiler test suite is passing, and a lot of the remaining work centers around getting the parser finished and rigging up the code generation to the AST traversal logic.

As you may or may not recall from previous updates, the code generator is already done and capable of generating the full Epoch compiler given a properly formatted AST; so what's remaining here is just glue between parsing and the code generation system to get it to where all the tests pass again and we can try the evil experiment of feeding the complete compiler into itself.

There are a number of parser features left to complete before this can happen:

  • Parenthetical expression support
  • Literal function parameters (used for pattern matching)
  • Higher order functions
  • References
  • Entities (flow control, etc.)
  • Function tagging
  • Sum type definitions
  • Templates
  • Some literal cleanup (floating point support being the biggest one for now)
    After that, some general features still need to be wired into the compiler. These are things that need nontrivial logic to exist between the parser and the code generation layer:

    • Overload resolution
    • Type inference for assignments and parenthetical expressions
    • Chained assignments
    • Function pointer members in structures
    • Pattern matching on values
    • Pattern matching on types
    • Template support
    • Some built-in operators and functions
    • Type demotion (e.g. integer -> 16-bit integer where appropriate)
    • Standalone code blocks
    • Batch test framework
    • Executable binary generation
      I also have a couple of known bugs to clean up before it's all said and done, but they're rather boring for the most part.

      On the one hand, this amounts to a whole lot of work; on the other hand, it's a measurable checklist and I still have until the end of the year to hit my personal deadline for the project.

      It's actually kind of a relief to see a finite list of things left to knock out. "Write a self hosting compiler" is kind of a tall order, and to finally be in a place where the end is clearly in sight is a great feeling.

      There are also some other reasons for me to be excited about the future of Epoch, but I can't really go into detail just yet. Stay tuned, life's about to get interesting.
Sign in to follow this  

1 Comment

Recommended Comments

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!