tree-sitter-gas

0

Описание

GNU Assembler grammar for Tree-sitter

Языки

  • C89,2%
  • C++5,9%
  • JavaScript2,7%
  • Rust1,3%
  • Assembly0,3%
  • Scheme0,3%
  • Остальные0,3%
3 года назад
22 дня назад
22 дня назад
22 дня назад
22 дня назад
3 года назад
3 года назад
22 дня назад
3 года назад
22 дня назад
3 года назад
3 года назад
3 года назад
22 дня назад
22 дня назад
22 дня назад
README.md

GNU Assembler (x86/x86-64) grammar for Tree-sitter

A Tree-sitter grammar for GNU Assembler (GAS) targeting x86 and x86-64 architectures. Supports both AT&T and Intel syntax styles.

Features

Supported Syntax Styles

  • AT&T Syntax: Full support with
    %
    register prefix (recommended)
  • Intel Syntax: Full support with
    .intel_syntax
    directive and square bracket memory addressing

Comment Styles

  • #
    - Line comments
  • /* */
    - C-style block comments
  • //
    - C++ style comments (in
    .S
    files with preprocessor)
  • ;
    - Statement separator (also acts as line terminator)

Directives

  • All standard GNU as directives (
    .global
    ,
    .section
    ,
    .ascii
    , etc.)
  • Intel syntax directive:
    .intel_syntax
    with
    noprefix
    /
    prefix
    options

Memory Addressing

  • AT&T:
    offset(%base, %index, scale)
    and
    %segment:offset
  • Intel:
    [base + index*scale + offset]
    with size directives (
    byte ptr
    ,
    word ptr
    ,
    dword ptr
    ,
    qword ptr
    , etc.)

Installation for Helix Editor

Add to your

~/.config/helix/languages.toml
:

Then run:

Recommendations

For best results:

  • Use AT&T syntax with
    %
    register prefix for reliable parsing
  • Intel syntax without
    %
    prefix is supported but may have edge cases with symbol names

Testing

Run tests with:

Examples

AT&T Syntax (x86-64)

Intel Syntax

For ARM/ARM64 assembly, see tree-sitter-arm.