From e01bf6e4ab85cae6cc76af9709a707f411960868 Mon Sep 17 00:00:00 2001 From: samsonium Date: Sun, 11 Oct 2026 03:59:19 +0300 Subject: [PATCH] feat: add README --- .gitignore | 1 + README.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ README.ru.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 README.ru.md diff --git a/.gitignore b/.gitignore index 2db0286..bd3a3a7 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ !/CMakeLists.txt !/Makefile !/README.md +!/README.ru.md diff --git a/README.md b/README.md index e69de29..21d6de7 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,49 @@ +# FromZero / Language + +[README in Russian](./README.ru.md) + +**FromZero/Language** is a package consisting of a JIT compiler and a virtual machine for the FZL language. + +## Features + +At the moment, the language has the following capabilities: + +- Builtin `printline` function for printing argument to stdout +- String and numeric literals +- Arithmetic operations: addition, subtraction, multiplication, division, modulo, power + + +## File extensions + +Standard file extensions: + +- `.fzs` - source code +- `.fzb` - compiled binary file + + +## Building + +1. Clone the repository: `git clone https://git.samsonium.dev/samsonium/fz-lang.git` +2. Build: `make build` + +After this, a "build" directory will appear in the project root. It will contain two executable files: + +- `fzc` - a compiler +- `fz` - virtual machine + +Both executables have usage help that can be displayed using `--help` flag (or `-h`). + + +## Development guideline + +You need a code editor with Clang LSP support because of `.clang-format` file in the project root. +This file provides set up codestyle rules. + +There is two targets in Makefile for debugging purposes: `build-c` for the compiler and `build-vm` for the VM. +Each target can be called with `FILE` variable. For example: + + +```shell +$ make debug-c FILE=exl/hw.fzs +``` + diff --git a/README.ru.md b/README.ru.md new file mode 100644 index 0000000..0307cbd --- /dev/null +++ b/README.ru.md @@ -0,0 +1,48 @@ +# FromZero / Language + +[README in English](./README.md) + +**FromZero/Language** - пакет из JIT-компилятора и виртуальной машины для языка FZL. + +## Текущие возможности + +На данный момент язык имеет: + +- Встроенную функцию `printline` для вывода аргумента в stdout +- Строковый и числовой литералы +- Арифметические операции: сложение, вычитание, умножение, деление, модуло, возведение в степень + + +## Расширения файлов + +Стандартными для языка являются два расширения файлов: + +- `.fzs` - исходный код +- `.fzb` - скомпилированный бинарный файл + + +## Инструкции по сборке + +1. Склонировать проект: `git clone https://git.samsonium.dev/samsonium/fz-lang.git` +2. Собрать проект: `make build` + +После этого в корне появится директория **"build"**. В ней будут лежать два скомпилированных бинарных файла: + +- `fzc` - компилятор +- `fz` - виртуальная машина + +Оба бинарных файла предоставляют справку по использованию при запуске с флагом `--help` (или `-h`). + + +## Гайдлайн по разработке + +Желательно иметь редактор кода, поддерживающий Clang LSP, так как в проекте есть готовые настройки для +форматтера в виде файла `.clang-format`. + +Для дебаггинга есть два таргета в CMake: `build-c` для компилятора и `build-vm` для виртуальной машины. +Оба таргета позволяют указать переменную с путём файла. Например, так: + +```shell +$ make debug-c FILE=exl/hw.fzs +``` +