tree-sitter-frisc
Version:
FRISC grammar for tree-sitter
28 lines (19 loc) • 471 B
JavaScript
module.exports = grammar({
name: 'frisc',
inline: $ => [$.condition],
word: $ => $.label,
extras: $ => [
/\s/,
$.comment,
],
rules: {
source_file: $ => repeat($._statement),
_statement: $ => seq(
optional($.label),
$.jump,
),
jump: $ => token(seq('JP', optional(seq('_', 'C')))),
label: $ => /[a-zA-Z]\w*/,
comment: $ => token(/;[^\r\n]*/),
}
});