flat assembler
Message board for the users of flat assembler.

Index > High Level Languages > [ANNOUNCE] PyFASM64: Python to Pure x86_64 FASM Native Compiler + FASM Modern SDK

Author
Thread Post new topic Reply to topic
eminsk



Joined: 07 Nov 2026
Posts: 1
eminsk 07 Nov 2026, 14:19
[ANNOUNCE] PyFASM64: Python to Pure x86_64 FASM Native Compiler + FASM Modern SDK



Hello FASM Community!



I would like to present PyFASM64 (GitHub: eminsk/pyfasm | PyPI: pyfasm64) and the companion FASM Modern SDK (GitHub: eminsk/fasm-modern-sdk).



PyFASM64 is an open-source native compiler that translates Python code directly into pure x86_64 Flat Assembler (FASM) source code, emitting tiny, self-contained standalone binaries with zero virtual machine and zero runtime overhead.



Why FASM as the Backend?

Instead of relying on heavy C runtimes, LLVM, or bloated intermediate representations, PyFASM leverages the unmatched speed, compactness, and elegance of Flat Assembler. The emitted code is clean, human-readable x86_64 FASM assembly adhering to official calling conventions and system ABIs.



Key Features:



  • Zero Virtual Machine & Zero-GIL: Eliminates the Python runtime and Global Interpreter Lock. Execution runs directly on bare metal with true multi-threaded native concurrency.

  • Native Target Architectures: Emits standalone Windows x64 PE+ executables (.exe) and dynamic libraries (.dll), Linux x86_64 ELF64 binaries, and macOS x64 Mach-O.

  • FASM Modern SDK Integration: Bundles and integrates fasm-modern-sdk v1.73.36 and fasmg v0.0.26. Standard Win64 headers (win64a.inc) and equates are embedded out of the box with zero environment configuration.

  • Native Modern Assembly Extensions:

    - ui_fluent.inc: Pure native Modern Fluent Dark UI styling, owner-drawn controls, and smooth Win32 GUI without external GUI dependencies.

    - json_fast.inc: Zero-allocation SIMD-accelerated JSON parser in pure assembly.

    - net_https.inc: Zero-dependency native WinINet and POSIX socket HTTPS/TLS client.

  • Unicode & UTF-8 / UTF-16LE Engine: Integrated native string conversion (_pyfasm_utf8_to_wide) resolving Windows wide-char APIs.

  • Object Model & Protocol Parity: Full support for operator overloading and container dunder methods (__len__, __getitem__, __setitem__, __contains__, __add__, __sub__, __eq__, __str__), generators, loop-else clauses, and multi-module static topological bundler.





Code Example & Generated x86_64 FASM Assembly:



Python source (fibonacci.py):

Code:

def fib(n: int) -> int:

    if n <= 1:

        return n

    return fib(n - 1) + fib(n - 2)



def main():

    result = fib(35)

    print("Fibonacci(35) =", result)



if __name__ == "__main__":

    main()

    




Emitted pure x86_64 FASM assembly (fibonacci.asm):

Code:

fib:

    push    rbp

    mov     rbp, rsp

    sub     rsp, 48                     ; shadow space + local frame

    mov     [rbp - 8], rcx              ; argument n

    mov     rax, [rbp - 8]

    cmp     rax, 1

    setle   al

    movzx   rax, al

    test    rax, rax

    jz      .recurse

    mov     rax, [rbp - 8]              ; base case: return n

    jmp     .epilog_fib

.recurse:

    mov     rax, [rbp - 8]

    dec     rax

    mov     rcx, rax                    ; argument n - 1

    sub     rsp, 32

    call    fib

    add     rsp, 32

    push    rax

    mov     rax, [rbp - 8]

    sub     rax, 2

    mov     rcx, rax                    ; argument n - 2

    sub     rsp, 32

    call    fib

    add     rsp, 32

    mov     r11, rax

    pop     rax

    add     rax, r11                    ; fib(n - 1) + fib(n - 2)

.epilog_fib:

    mov     rsp, rbp

    pop     rbp

    ret

    




Compiling and benchmark result:

Code:

# Compile directly with bundled FASM:

pyfasm compile fibonacci.py -o fibonacci.exe --target win64



# Execution benchmark:

# CPython 3.12:  1586 ms

# PyFASM Native:   95 ms  (16.7x faster!)

# Binary size:   9 KB standalone PE+ executable (no external dependencies)

    




Links & Resources:





Feedback, ideas, and suggestions from fellow assembly and compiler developers are very welcome!
Post 07 Nov 2026, 14:19
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2026, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.