adam-mcdaniel / oakc

A portable programming language with a compact intermediate representation
Apache License 2.0
729 stars 21 forks source link

Implemented conditional compilation, user compiler errors, and the extern flag #20

Closed adam-mcdaniel closed 4 years ago

kevinramharak commented 4 years ago

Wow this is looking promising

adam-mcdaniel commented 4 years ago

This pull request introduces several breaking changes. Here's a comprehensive list.

fn test() { test!() }

fn main() -> void { test(); }


- The `-f` command line argument flag has been removed because of the `extern` flag.
kevinramharak commented 4 years ago

Do you think a character is enough? It feels a bit limited. Other than that this seems like good progess.

adam-mcdaniel commented 4 years ago

I definitely think a character is enough. Surely there's no way we can exhaust the 95 printable characters, right? Also, the HirConstant structure only supports data of size 1, so the only other alternative is a float, which seems less intuitive.

adam-mcdaniel commented 4 years ago

I'm incredibly surprised at how quickly this is coming together. The robustness of the HIR and MIR implementations make it so much easier to add features than I anticipated.

kevinramharak commented 4 years ago

:D yeah I guess that should be enough. Just need to make sure there are no conflicts.

Yeah thats what I like about this project. Its architecture make it very easy to understand and work with. I have no idea how most of it works, but I don't have to since I can focus on the part that interfaces with the target for now. I am also looking forward to optimization passes. I have noticed a few patterns that seem redundant like a store then a load of the same value again.

adam-mcdaniel commented 4 years ago

Yes, because the resulting ASM instructions are so simple, it should be incredibly easy to do some low-level optimization. Additionally, the structure of the MIR should make high level optimizations a breeze, too. I'm very excited. I want to thoroughly vet the soundness of the type system and the rest of the compilation process before tackling this, though.