tree-sitter-m68k
Version:
Motorola 68000 family assembly grammar for tree-sitter
193 lines (186 loc) • 5.11 kB
Plain Text
============================================
Numeric Literals
============================================
move 1,d0
move $1,d0
move %1,d0
move @1,d0
(source_file
(instruction
mnemonic: (instruction_mnemonic)
operands: (operand_list (decimal_literal) (data_register)))
(instruction
mnemonic: (instruction_mnemonic)
operands: (operand_list (hexadecimal_literal) (data_register)))
(instruction
mnemonic: (instruction_mnemonic)
operands: (operand_list (binary_literal) (data_register)))
(instruction
mnemonic: (instruction_mnemonic)
operands: (operand_list (octal_literal) (data_register)))
)
============================================
Symbols
============================================
move foo,d0
move .foo,d0
move .68k,d0
(source_file
(instruction
mnemonic: (instruction_mnemonic)
operands: (operand_list (symbol) (data_register)))
(instruction
mnemonic: (instruction_mnemonic)
operands: (operand_list (symbol) (data_register)))
(instruction
mnemonic: (instruction_mnemonic)
operands: (operand_list (symbol) (data_register)))
)
============================================
String Literals
============================================
move "foo bar",d0
move "foo ""bar"" baz",d0
move "foo \"bar\" baz",d0
move 'foo bar',d0
move 'foo ''bar'' baz',d0
move 'foo \t \n \xf9 \X9f \17 \'bar\' baz',d0
move 'foo \@ baz',d0
(source_file
(instruction
mnemonic: (instruction_mnemonic)
operands: (operand_list (string_literal) (data_register)))
(instruction
mnemonic: (instruction_mnemonic)
operands: (operand_list (string_literal) (data_register)))
(instruction
mnemonic: (instruction_mnemonic)
operands: (operand_list (string_literal) (data_register)))
(instruction
mnemonic: (instruction_mnemonic)
operands: (operand_list (string_literal) (data_register)))
(instruction
mnemonic: (instruction_mnemonic)
operands: (operand_list (string_literal) (data_register)))
(instruction
mnemonic: (instruction_mnemonic)
operands: (operand_list (string_literal) (data_register)))
(instruction
mnemonic: (instruction_mnemonic)
operands: (operand_list (string_literal (macro_arg)) (data_register)))
)
============================================
Unary Expressions
============================================
move -1,d0
(source_file
(instruction
mnemonic: (instruction_mnemonic)
operands: (operand_list
(unary_expression
operator: (operator)
operand: (decimal_literal))
(data_register))))
============================================
Binary Expressions
============================================
move 1+1,d0
move 1+2*2,d0
move (1+2)*2,d0
move [1+2]*2,d0
(source_file
(instruction
mnemonic: (instruction_mnemonic)
operands: (operand_list
(binary_expression
left: (decimal_literal)
operator: (operator)
right: (decimal_literal))
(data_register)))
(instruction
mnemonic: (instruction_mnemonic)
operands: (operand_list
(binary_expression
left: (decimal_literal)
operator: (operator)
right: (binary_expression
left: (decimal_literal)
operator: (operator)
right: (decimal_literal)))
(data_register)))
(instruction
mnemonic: (instruction_mnemonic)
operands: (operand_list
(binary_expression
left: (parenthesized_expression
(binary_expression
left: (decimal_literal)
operator: (operator)
right: (decimal_literal)))
operator: (operator)
right: (decimal_literal))
(data_register)))
(instruction
mnemonic: (instruction_mnemonic)
operands: (operand_list
(binary_expression
left: (parenthesized_expression
(binary_expression
left: (decimal_literal)
operator: (operator)
right: (decimal_literal)))
operator: (operator)
right: (decimal_literal))
(data_register)))
)
============================================
Built-in symbols
============================================
move reptn,d0
move carg,d0
move narg,d0
(source_file
(instruction
mnemonic: (instruction_mnemonic)
operands: (operand_list
(reptn)
(data_register)))
(instruction
mnemonic: (instruction_mnemonic)
operands: (operand_list
(carg)
(data_register)))
(instruction
mnemonic: (instruction_mnemonic)
operands: (operand_list
(narg)
(data_register)))
)
============================================
PC
============================================
move *+2,d0
label = *+2
(source_file
(instruction
mnemonic: (instruction_mnemonic)
operands: (operand_list
(binary_expression
left: (pc)
operator: (operator)
right: (decimal_literal))
(data_register)))
(symbol_definition
name: (symbol)
value: (binary_expression
left: (pc)
operator: (operator)
right: (decimal_literal)))
)