Chapter 1. Goals

Table of Contents

1.1. Key Internal Features

The goal of the yasm project is to write an assembler that is a more easily extensible version of NASM, ultimately allowing for machine architectures other than x86 and multiple assembler syntaxes (such as TASM and GAS in addition to NASM). In general, yasm tries to work like NASM, except where there’s a compelling reason to be different. To allow these features, the yasm assembler is structured in a very modular fashion.

1.1. Key Internal Features

  • A NASM syntax parser written in Yacc. This simplifies the source code and increases performance: Yacc-generated parsers are almost always faster than hand-written ones. Also, Yacc (and its GNU implementation, bison) is an extremely well-tested and well-documented tool.
  • Architecture-specific instruction parsers hand-written for simplicity and size, as well as to make it easy to add additional architectures while retaining the same front-end syntax. The blend of Yacc for syntax and a hand-written parser for instructions strikes a great balance between the strengths and weaknesses of each approach.
  • A NASM syntax lexer written in re2c. A highly efficient scanner generator (almost always faster than lex/flex), it’s also very embeddable due to its code generation methodology, allowing a number of re2c scanners to be used in various places in yasm without any worries about naming conflicts.
  • Many of the modular interfaces at least superficially finished. This is still an area that needs a lot of work.
  • A small set of portable equivalents of useful functions that are standard on some systems (detected via configure), such as the queue(3) set of functions, strdup, strcasecmp, and mergesort.
  • A decent (and growing) set of assembler test input files to test the entire assembler as well as specific modules.