Giter Club home page Giter Club logo

assembly-syntax-definition's Introduction

Sublime Text: x86 Assembly Syntax Definition (AT&T/GAS)

This is the greatest syntax definition of All Time

Sublime Text syntax definition for x86 assembly (GAS/AT&T syntax)

I do not have plans to support any other syntax type (such as Intel). Sufficient packages already exist.

Covers a lot of instructions for a lot of different cpuid flags, even if you don't have them.

Purpose: I couldn't find any good ones online, so I made one myself for my ECE391 class at UIUC. None of the ones I did find did a good job highlighting the right instructions. This is not to say that this definition is perfect, but for the purposes of your college level systems programming class, it will do just fine.

I have included some test files in the 'test/' directory of this package. Look around if you like. I even included a gdb disas dump, which I think is a good test for efficacy.

Ports to other editors

This has become somewhat of a parent-project for various ports, so here's a list of links to ports I've made:

  • Atom. Same highlighting features. It was a direct JSON->CSON conversion. No snippets.
  • Vim. Probably same highlighting features. Regex syntax was kind of hard to nail down. Might extend with snippet-like features later.
  • Gedit. It's a bit of a weaker port, but it should look reasonably close. It was a bit frustrating to write, with so little documentation around.
  • More perhaps to come later. I currently have no plans to port to Emacs. Writing major modes seems like a major pain compared to how easy it is for Vim. I also will not do Notepad++.

Installation

  • Get Sublime Text.
  • Install "Package Control": https://sublime.wbond.net/installation
  • In your Sublime window menu, go to Preferences>Package Control and type "Install".
  • Type "gasx" to find the package.
  • This has the advantage of automatic updates if a bug is caught.

Manual Install

  • Download the contents of this repo.
  • Extract/copy/Whatever-I-Don't-Care all files into your 'Packages' directory.
    • This is easily accessible from Preferences>Browse Packages...
    • You could always just git pull in the 'Packages' directory.
  • If all this has failed, you're on your own. Good luck.

Sublime should automatically take care of the syntax highlighting, so there's no need to restart.

If you feel the directions are unclear, please tell me. Or tell Dennis, so we can make fun of you later.

Pull requests and/or bug reports are always welcome.

Features (Secret Q/A):

  • Can't remember a system call number? Start with your architecture (32/64) and type the call you want (e.g. mmap, read), press tab/enter, and let the autocomplete do the rest.
    • E.g. I want to use mmap on x64. I type 64mmap, enter, and it expands to #define SYS_MMAP $9.
  • Can't remember displacement syntax? Just start typing "displace" and select the helper option in autocomplete. Then tab through the arguments.
  • How do I start a standalone assembly program? Type skel32 or skel64, autocomplete. Compiles with gcc -nostdlib.
  • How do I set up a stack frame for calling a function? Type newframe32 or newframe64.

Demo on gdb disassembly log: Demo

assembly-syntax-definition's People

Contributors

calculuswhiz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

assembly-syntax-definition's Issues

BUG: comment highlighting

There is a bug with highlighting comment. It works fine in code part, but it also hightlights comment part.

See the picture below.

prob

Thank you for developing this useful package! ๐Ÿ‘

Comment started by C preprocessor directive is a corner case where highlighting fails.

First of all, let me say this package is really great; I've been using it weekly for uni assignments.

Problem

I noticed that a comment started by the some keywords on a line by itself gets highlighted as an error. The list of what I tested follows (all C preprocessor directives).

  1. define
  2. error
  3. if
  4. ifdef
  5. ifndef
  6. include
  7. pragma
  8. undef

It happens if there is nothing but spaces or tabs in between the hash and the if keyword.
If there is no whitespace, it highlights as an assembler directive.

MWE

# if
#if

All of the following lines work fine.

# <anything> if
// if
/* if */

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.