Features Examples Commands Installation Community GitHub

Command Line AsmX G3

Full control over compilation and code generation through powerful terminal commands

Powerful Features

AsmX G3 provides advanced command line options for full control over compilation

Flexible Compilation

Support for many options to customize the compilation process for your needs.

  • Target architecture selection (`--march`)
  • JIT compilation for rapid prototyping
  • AOT compilation to native ELF files
  • Output file name customization (`-o`)

Informational Flags

Get all the information you need about the compiler and its environment.

  • View version (`-v`, `--version`)
  • Target machine info (`--dumpmachine`)
  • llvm.js version data
  • Hide confidential info (`--hinfo`)

Performance and Updates

Tools for performance analysis and keeping the compiler up to date.

  • Stage runtime profiling (`--profiletime`)
  • Built-in update command (`--update`)
  • Production builds (`-r, --release`)
  • Full x86_64 architecture support

Usage Example

Typical scenarios for working with the compiler via the command line.

Native Program Compilation
# Compile compile.asmx file to a native executable for x86_64
asmx compile.asmx --release --march x86_64 -o my_program

# Run the generated ELF file
./my_program

# JIT-execute a file for quick testing
asmx factorial.asmx

# Get compiler version info
asmx --version

# Update the compiler to the latest version
asmx --update
Native Program Example (compile.asmx)
@include libc;

@section rodata {
  message: str("Hello World!\n")
}

@fn pub main {
  @mov $1, %rax
  @mov $1, %rdi
  @mov &message, %rsi
  @mov $21, %rdx
  @syscall

  @mov $60, %rax
  @mov $0, %rdi
  @syscall
}
$ asmx compile.asmx -r -m x86_64 -o hello
$ ./hello
Hello World!

Command and Flag Reference

Full list of commands and options for the AsmX G3 compiler

Informational Flags

-h, --help
Show help information.
-v, --version
Show full version information.
--dumpversion
Show only the compiler version number.
--dumpmachine
Show the compiler target architecture.

Compilation Flags

-r, --release
Compile to a native executable. Requires the `--march` flag.
-o, --objname [name]
Set the output file name.
-m, --march [architecture]
Specify the target architecture (e.g., `x86_64`).
--update
Update the AsmX compilation platform to the latest version.

Additional Options

--profiletime
Enable time profiler for compilation stages.
--hinfo
Hide confidential information (e.g., file paths) in logs.
@file, --file file
Specify a file for parameter processing.

LLVM Utilities

--llvm@version
Show full llvm.js version information.
--llvm@dumpversion
Show only the llvm.js version.
--llvm@repository
Show the llvm.js repository.

Installing AsmX G3

Get started with AsmX G3 in just a few steps

1

Install Node.js

AsmX G3 requires Node.js version 16 or higher to work

$ sudo apt install nodejs # For Debian/Ubuntu
$ brew install node # For macOS
2

Install AsmX G3

Install the compiler via npm (Node.js package manager)

$ npm install -g asmx-g3

Or build from source:

$ git clone https://github.com/AsmXFoundation/AsmX-G3.git
$ cd asmx-g3
$ npm install
$ npm link
3

Check the installation

Make sure the compiler is installed correctly

$ asmx --version
AsmX G3 Compiler v1.0.0
Target: x86_64-linux-gnu