Files
fz-lang/docs/en/book/01_getting-started.md
T

1.6 KiB

Getting started

To get started with FZLang, you need two executable files on your computer:

  • fzc — the compiler
  • fz — the virtual machine

To compile a program, run fzc and pass it the paths to your source files. If compilation succeeds, run the compiled program with fz, passing the path to the compiled file. If you do not specify an output path for the compiler, it saves the compiled program as a.fzb.

Compiler options

To see the available compiler options, run fzc --help (or fzc -h). The help currently looks like this:

Usage: fzc [flags] <sources...>
Available flags:
        -h      --help          Print help
        -v      --verbose       Display compilation info (tokens, AST, consts table, etc)
        -V      --version       Print compiler version
        -o      --out           Set compiled file name

The -h (--help) flag prints the same help text. The -v / --verbose flags print detailed compilation information, including:

  • The tokens that were read;
  • The syntax tree that was built;
  • The values stored in the constants table;
  • The opcodes written to the program.

The -V / --version flags print the compiler version. The -o / --out flags let you choose the output file path.

Virtual machine options

The virtual machine has two options: --help (-h) and -d.

  • --help (or -h) prints the help text;
  • -d <path to file> prints the opcodes with their indices. Use this flag to see how the VM will read your program.

Next: Basics and types

Previous: Introduction