Skip to content
Hazurl edited this page Dec 21, 2018 · 3 revisions

Lexer

L001 - Unknown character

A character not part of the character set has been reached. Makes sure you didn't mistype.

Example:

begin:
	; § will trigger the L001 error
	mov §, 1

L002 - Unknown escape sequence

\a, \b, \f, \n, \r, \t, \v, \0 are the only escape sequences possible in a string. You can also escape the escape character \\.

Example:

str:
	db "String\u" ; \u is not a valid escape sequence, and L002 will be triggered

L003 - Invalid number prefix

0b, 0x, 0o, 0d are the only valid prefix for numbers literals.

Example:

begin:
	mov @A, 0h1234 ; 0h is not a valid prefix, L003 will be triggered

L004 - Invalid symbol in the number

This error happened when a character is not part of the base's set.

  • 0b must be followed by one or more 0, 1
  • 0o must be followed by one or more 0..7
  • 0x must be followed by one or more 0..9, A..F (case insensitive)
  • 0d and numbers without prefix must be followed by one or more 0..9

Example:

begin:
	mov @A, 0o8552 ; 8 is not part of octal's character set, so L004 is triggered
	mov @A, 0x22GG ; G is not part of hexadecimal's character set

L005 - Invalid register

The identifier following @ must be a register name: A..L, SP, BP, PC, FG (case insensitive).

Example:

begin:
	mov @r, 1337 ; r is not a register, so L005 is triggered

L006 - Invalid floating number

Floating numbers can only be in base 10. This error can also happen if you put two points or if the number starts or end by a point.

Example:

begin:
	mov @a, 0x2.3 ; not in base 10
	mov @a, 0d12.23.45 ; multiple points
	mov @a, .2, 0., 0d.1 ; starts/end by a point

L007 - Undefined number

After a prefix, you must write a number.

Example:

begin:
	mov @a, 0x ; no number after the prefix, so L007 is triggered

L008 - Expected register name

After a @, you must writes a register.

Example:

begin:
	mov @, 0x1 ; no register after '@', L008 is triggered

Parser

P001 - Unknown instruction name

The instruction is not part of the set of instructions. You can get the list of instructions here.

Example:

begin:
	movv @a, @b ; movv is not a valid instruction

P002 - Expression expected

After a comma, you need an expression.

Example:

begin:
	mov @a, @b, ; trailing comma is not allowed

P003 - Expected new line after the label

You must continue on a new line after a label declaration.

Example:

begin: mov @a, @b ; not allowed

P004 - Unknown directive

This directive is not part of the directive list, you can find the list here.

Example:

# something ; something is not valid

P005 - Invalid Alignment

Alignment directive must be followed by a number power of 2.

Example:

# align 5 ; 5 is not a power of 2
# align oops ; oops is not a number

P006 - String in expression

Strings can only appear in the data section, you can, however, use characters literals as numbers in expressions (1 + "a" or 1 + 'a').

Example:

begin:
	mov @a, "hello world" ; string not in data section
	mov @a, "ok" + 2 ; string expression

P007 - Registers not constant

Registers cannot appear in constant expressions. Constants expression are used as a displacement, as an argument, and in the data section.

Example:

data:
	db @a ; error, register in data section
begin:
	inc @a + 2 ; error, register in constant expression
	lea @a, [@b + @c] ; error, register in displacement