Hacker News new | ask | show | jobs
by gravypod 3459 days ago
Go into the compiler explorer [0] and type the following

    val num = 10
Then take a look at the x86 generation.

What is all of that. It doesn't look like executable data needed. Is that just implicit functions or something baked into the language? If it is, why isn't it being tree-shook?

2 comments

It seems you need to add a semi-colon after the line (the AST was empty). A minimal program is simply "();", and compiles into something even more complex. A big part of it looks like runtime setup/cleanup code, common for all programs.
It seems that there are some examples here: https://github.com/CakeML/cakeml/blob/master/explorer/exampl... Whould be cool to have these examples accessible from the web interface of the compiler explorer.
Sadly it doesn't seem like you can link to a compiler output from their compiler.