30
0c370t
7y

Just finished up my first compiler, with accurate extensible error reporting, and the syntax system is generically typed so I can reuse it. Pretty fucking pleased with myself

Comments
  • 1
    Great job
  • 1
    Wow congratulations! I have always liked this kind of things. How much time did it take you?
  • 1
    The problem with the problem of error reporting is that it is ill-defined. Can you please elaborate on how do you know/define the accuracy of the error reporting? (Of course, intuitive or subjective definition is also useful).

    Curiosity aside, sounds like an awesome project.
  • 1
    cool, is it open-source? what language did you write it in?
  • 0
    My slightly messy and underdocumented code can be found on GitHub : https://github.com/Project-Name/...
  • 1
    Because it's built for an assembly language error reporting is fairly straightforward, but should be extendable. Right now it deconstructs a regular expression based on some standards, and uses that to iterate over the line to locate a problem
  • 1
    Force is strong with this one.
  • 1
    Now that I'm awake enough to be a little more clear, the package in question is site.projectname.nicasm, and BetterAssembler is the entry point, if you're looking at the source. Most of the error reporting is handled by site.projectname.err.SyntaxErrorException and it's based on an enum that implements site.projectname.lang.Syntax
  • 0
    @magnusi its written in Java, I'm most familiar with it on a detailed level and the I like data structures it has built in as well as the way exceptions work
  • 0
    @0c370t nice, while I am not much of a fan of Java (in fact, quite the opposite), it's good if it suits your needs the best.

    I have also been writing a compiler lately, mine is quite earlier in development though. Parsing and AST cleaning is done with pure C, while only two days ago I began writing some analysis and tree-processing in very unsafe Rust.
  • 2
    Specifically for writing compilers, Java is not the ideal language. You will probably want pattern matching and algebraic types.
    For code generation Java is probably fine.
  • 2
    I hope Hooli doesn't steal your project ;)
Add Comment