Zulip Chat Archive

Stream: lean4

Topic: Quick compiling of a single file


Trebor Huang (Dec 05 2022 at 17:20):

Is there a way to quickly compile a single file without setting up a project? I would like it to be compiled instead of interpreted, and it has no dependencies, for some random testing around.

Henrik Böving (Dec 05 2022 at 17:22):

lean --run foo.lean should do the trick

Trebor Huang (Dec 05 2022 at 17:23):

Ahh, so that compiles? I haven't tried that. I'm AFK right now.

Henrik Böving (Dec 05 2022 at 17:24):

Oh sorry I misread that, compiling would be a bit harder. I guess you can in theory look at the output of lake build --verbose if you want to figure out the specific commands for that.

Christian Pehle (Jan 04 2023 at 14:01):

You can use the lean and leanc executables directly. If the file you want to compile is "foo.lean", then a command would be

lean foo.lean -c foo.c
leanc foo.c -o foo

If you want this to be an executable then foo.lean needs a main function.


Last updated: Dec 20 2023 at 11:08 UTC