Inspiration
I was inspired by a meme project I had heard about in passing where programs are compiled down a large number of docker containers, to make running programs take as much time and resources as possible, I wanted something similarly cursed but a little lower level.
What it does
At the moment the parser is rather buggy and the typechecker appears to be complete, with minimal testing. There is unfortunately no actual code-generation phase yet.
How we built it
The project was built using OCaml 5.4.1, using the "batteries-included" standard library and the angstrom parser combinator library.
Challenges we ran into
The OCaml tooling is....challenging to say the least, with minor changes in, for example, a type declaration, requiring one to run the dune build command (successfully) and manually restart the LSP just to get spurious errors to go away. I also ran into the issue of the ppx library I wanted to use (ppx_show) being unmaintained and only supporting ancient ocaml compiler versions (I have experienced so many version conflicts with ocaml's package management in general), meaning I had to waste time writing pretty printing code by hand. There was very little prosaic/demonstrative documentation for the angstrom parser combinator library, and I essentially had to resort to a random gist I found years back in order to see how to use it, this meant that I ended up with significant bugs that I was not able to resolve, likely due to a misuse of combinators like choice and <|> , debugging a mess of combinators was really hard considering that angstrom doesn't have the ability to easily keep track of or preserve any byte-spans or position/location information (this also made testing the typechecker harder as the origin of errors was uncertain), though I did later find out that there was an intentionally undocumented variable available that let you calculate the remaining string input (i.e. the area after which the syntax error occurred). In summary, due to a combination of me being primarily a rust programmer, poor planning/estimation of my capabilities and all of the above, I was not able to carry out the main objective of the project.
Accomplishments that we're proud of
I finally got round to writing a significant-ish amount of OCaml, something I have been meaning to do for a while. I also came up with a somewhat feasible idea in a fairly timely manner on my own. I also managed to figure out how to implement auto-currying for typed functions with great difficulty (at least I didn't have to do actual type inference on top of that lol), it required some surprisingly convoluted list chicanery and a bunch of folding.
What we learned
I learned that I ought to nap when given the opportunity, but also to find some teammates that share my interests so that these more ambitious projects can be a lot more viable.
What's next for ShellML
I will definitely be finishing off this project in my own time, as I'm curious how creative I can get with the compiler output. I may need to reconsider the choice of parser combinator library, unless i can get angstrom working the way I desire.
Built With
- compiler
- langdev
- language-development
- ocaml
- pldev
Log in or sign up for Devpost to join the conversation.