buzz_assembler

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revisionBoth sides next revision
buzz_assembler [2016/04/08 18:24] rootbuzz_assembler [2016/04/09 21:28] – [Debugging Information] root
Line 1: Line 1:
 ===== Buzz Assembly Language Specification ===== ===== Buzz Assembly Language Specification =====
 +
 +==== Assembly Commands ====
  
 The Buzz Virtual Machine (BVM) is a [[https://en.wikipedia.org/wiki/Stack_machine|stack machine]] that works with a custom assembly language. The instruction set is composed of 46 elements. Each command can be used either by writing Buzz Assembly code directly (in a ''.basm'' file); most of them, have a corresponding C-function that can be used when integrating Buzz with other software. The Buzz Virtual Machine (BVM) is a [[https://en.wikipedia.org/wiki/Stack_machine|stack machine]] that works with a custom assembly language. The instruction set is composed of 46 elements. Each command can be used either by writing Buzz Assembly code directly (in a ''.basm'' file); most of them, have a corresponding C-function that can be used when integrating Buzz with other software.
Line 47: Line 49:
 | ''jumpz POS''                               | If ''stack(1) == 0'', sets the program counter to ''POS''; pops operand | | ''jumpz POS''                               | If ''stack(1) == 0'', sets the program counter to ''POS''; pops operand |
 | ''jumpnz POS''  |                             | If ''stack(1) != 0'', sets the program counter to ''POS''; pops operand | | ''jumpnz POS''  |                             | If ''stack(1) != 0'', sets the program counter to ''POS''; pops operand |
 +
 +==== Debugging Information ====
 +
 +To make human-readable error reporting possible, assembly code can be annotated with extra information. Debugging annotations are added to each assembly code line. To mark the beginning of the information, the character ''|'' is used; after this character, the line number, column number, and file name are reported, separated by commas. No spaces are allowed before or after the commas. Line and column counts start from 1. For example:
 +
 +<file>
 +@__label_0
 + pushs 0 |7,18,/Users/myuser/test.bzz
 + pushi 2 |7,20,/Users/myuser/test.bzz
 + gstore |7,21,/Users/myuser/test.bzz
 +</file>
 +
 +Debugging information is not mandatory for each line. In fact, the preamble of any Buzz assembly file (the part in which strings are recorded and global symbols are registered) have no associated debugging information.
 +
 +== Tool support ==
 +
 +  * Debugging information is automatically generated by [[buzz_toolset#bzzparse|bzzparse]] upon compiling a Buzz script.
 +  * [[buzz_toolset#bzzasm|bzzasm]] takes each assembly line and uses the assembly command to produce bytecode, and the associated debugging information to produce a debugging information file.
 +  * [[buzz_toolset#bzzdeasm|bzzdeasm]] performs the opposite process: it takes as input a bytecode file and a debugging information file, and produces an annotated assembly code file.
  • buzz_assembler.txt
  • Last modified: 2016/07/14 23:47
  • by ilpincy