@voproser45654
Мечтаю писать на машинных кодах

Как скомпилировать код при помощи nelua?

Скомпилировал компилятор nelua. На сайте обещали компиляцию кода в машинный, однако в опциях такого нет.
  • Вопрос задан
  • 168 просмотров
Пригласить эксперта
Ответы на вопрос 1
vabka
@vabka
Токсичный шарпист
однако в опциях такого нет.

Всё есть


❯ nelua --help
Usage: nelua
([-c] | [-a] | [-b] | [-B] | [-Y] | [-A] | [-H] | [--script] | [--lint] | [--print-ast] | [--print-analyzed-ast] | [--print-ppcode] | [--print-code] | [--print-assembly])
[-h] [-i] [-d] [-S] [-r] [-M] [-s] [-t] [-T] [-V] [-w] [-C]
[--no-color] [-R ] [-o ] [-D ] [-P ]
[-g ] [-L ] [--cc ] [--cflags ]
[--ldflags ] [--stripflags ]
[--cache-dir ] [--path ]
([] | [--config] | [-v] | [--semver]) [] ...

Nelua 0.2.0-dev

Arguments:
input Input source file
runargs Arguments passed to the application
Use '--' to is passed)

Options:
-h, --help Show this help message and exit.
-c, --code Compile the backend code only
-a, --analyze Analyze the code only
-b, --binary Compile the binary only
-B, --object Compile as an object file
-Y, --assembly Compile as an assembly file
-A, --static-lib Compile as a static library
-H, --shared-lib Compile as a shared library
--script Run lua a script instead of compiling
--lint Check for syntax errors only
--print-ast Print the AST only
--print-analyzed-ast Print the analyzed AST only
--print-ppcode Print the generated Lua preprocessing code only
--print-code Print the generated code only
--print-assembly Print the assembly generated code only
--config Print config variables only
-v, --version Print compiler detailed version
--semver Print compiler semantic version
-i, --eval Evaluate string code from input
-d, --debug Run through GDB to get crash backtraces
-S, --sanitize Enable undefined/address sanitizers at runtime
-r, --release Release build (optimize for speed and disable
runtime checks)
-M, --maximum-performance Maximum performance build (use for benchmarking)
-s, --strip-bin Remove symbols from the compiled binary (reduce its
size)
-t, --timing Show compile timing information
-T, --more-timing Show detailed compile timing information
-V, --verbose Show compile related information
-w, --no-warning Suppress all warning messages
-C, --no-cache Don't use any cached compilation
--no-color Disable colorized output in the terminal.
-R , Execute compiled output with a runner
--runner
-o , Output file.
--output
-D , Define values in the preprocessor
--define
-P , Set initial compiler pragma
--pragma
-g , Code generator backend to use (lua/c) (default: c)
--generator
-L , Add module search path
--add-path
--cc C compiler to use (default: gcc)
--cflags Additional flags to pass to the C compiler (default:
)
--ldflags Additional flags to pass when linking (default: )
--stripflags Additional flags to pass when striping (default: -x)
--cache-dir Compilation cache directory (default:
/home/vabka/.cache/nelua)
--path Set module search path (default:
./?.nelua;./?/init.nelua;/usr/local/lib/nelua/lib/?.nelua;/usr/local/lib/nelua/lib/?/init.nelua)


Просто чтобы получить исполняемый файл ты должен сказать, куда его надо сохранить
Прямо сейчас даже себе поставил и всё работает:
$ sudo apt-get install build-essential git gcc gdb # устанавливаем инструменты сборки
$ git clone https://github.com/edubart/nelua-lang.git # скачиваем репозиторий
$ cd nelua-lang # переходим внутрь
$ make # собираем
$ sudo make install # устанавливаем
$ cd ./examples # переходим в примеры
$ nelua ./helloworld.nelua -o hw # собираем пример helloworld.nelua и сохраняем в файл hw
$ chmod +x ./hw # метим файл как исполняемый (вообще у него и так должен быть +x, но это на всякий случай)
$ ./hw # запускаем
hello world
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы