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

stage 1: a simple compiler #1

Open
20 of 27 tasks
glaebhoerl opened this issue Jul 26, 2017 · 0 comments
Open
20 of 27 tasks

stage 1: a simple compiler #1

glaebhoerl opened this issue Jul 26, 2017 · 0 comments
Assignees

Comments

@glaebhoerl
Copy link
Owner

glaebhoerl commented Jul 26, 2017

  • Make a Stack project w/ the chosen dependencies
  • Make sure they all resolve & build etc.
  • Figure out what the initial minimal language will be?
  • Make sure LLVM still works w/ the OrcJIT example
  • Figure out what a concrete syntax tree should look like as a Haskell type

  • Write some types?
  • Lex something
  • Parse something
  • Resolve names
  • Typecheck something
  • Translate to an IR (ANF w/ basic blocks & basic block args?)
    • BBs or EBBs? probably BBs for now to simplify translation to LLVM
  • Generate some code
  • Output a binary
  • Make sure it actually runs & works

  • Write tests for everything! http://teh.id.au/posts/2017/06/07/round-trip-property/index.html
    • Write pretty printers
      • AST
      • IR
      • Error messages
    • Write well-formedness validators
    • Write a typechecker for the IR as well
    • Write an evaluator
    • Write fizzbuzz
  • Write a usable CLI
  • Make it JIT
  • Go back and fix the fixable FIXMEs and TODOs
  • Write a README w/ overview

two types: Int, Bool
arithmetic and comparison operators
if, while; forever/break?
let, var
read(), write()
mutation (assignment)
no functions yet

Example program:

 var n = 0
 forever {
     write(n)
     let m = read()
     if m == 0 {
         return
     }
     n = n + m
 }
@glaebhoerl glaebhoerl changed the title Implement a thing stage 1: a simple compiler Jul 27, 2017
@glaebhoerl glaebhoerl self-assigned this Jul 27, 2017
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

1 participant