Improve entrypoint doc

This commit is contained in:
imaqtkatt 2024-02-08 18:16:12 -03:00
parent 78c1ee1c31
commit de23e5c972

View File

@ -236,22 +236,23 @@ main = (id foo)
If given the option, use another definition as entrypoint rather than `main` or `Main`.
> HVM-Lang finds by default for a `main` or `Main` as entrypoint to a program, but it is possible to use a different entrypoint with the `-e --entrypoint` option.
> By default, HVM-Lang searches for a function named either `main` or `Main` to use as entrypoint to a program, but it is possible to use a different entrypoint with the `-e --entrypoint` option.
Example:
```
// program
Main = (λx x λx x)
// compilation output, Main or main becomes a @main definition
// compilation output, both `Main` and `main` compile to a `@main` definition
@main = a
& (b b) ~ ((c c) a)
// program
// should fail as the program does not have a `main` definition.
// Normally would fail as the program does not have a `main` definition.
run = (λx x λx x)
// compilation output, --entrypoint run.
// compilation output using `--entrypoint run`.
// No `@main` definition is created.
@run = a
& (b b) ~ ((c c) a)
```