hljs.registerLanguage('archasm', function(hljs) {
  return {
    name: 'ArchASM',
    aliases: ['archasm'],

    keywords: {
      keyword: `
        NOP HALT
        PRINT PRINT_TOP
        JMP JZ JNZ
        ENTER LEAVE LGET LSET
        BEGIN_TICK END_TICK
        SAVE_GRID LOAD_GRID LOAD_ONT
        PUSH_INT PUSH_FLOAT PUSH_BOOL PUSH_SYM
        PACK_VALUE
        UNPACK_VALUE_INT UNPACK_VALUE_FLOAT
        UNPACK_VALUE_BOOL UNPACK_VALUE_SYM
        IADD ISUB ADD SUB MUL DIV IMUL IDIV
        EQ LT NOT
        SWAP OVER ROT NROT DUP2 NIP TUCK
        POP DUP
        CREATE_NODE CREATE_EDGE
        DELETE_NODE DELETE_EDGE
        SET_NODE_PROPERTY GET_NODE_PROPERTY
        UNSET_NODE_PROPERTY
        SET_EDGE_PROPERTY GET_EDGE_PROPERTY
        UNSET_EDGE_PROPERTY
        ADD_INCIDENT_NODE REMOVE_INCIDENT_NODE
        SET_INCIDENCE
        FIND_INCIDENTS
        GET_NODE_TYPE GET_EDGE_TYPE
        GET_EDGE_ARITY GET_EDGE_NODE_AT
        TRY_GET_NODE_PROPERTY
        TRY_GET_EDGE_PROPERTY
        GET_TIMELINE GET_ORIGIN_TICK
        IS_MAIN GET_CURRENT_TICK
        PUSH_VIEW POP_VIEW
        EMIT_CLAIM EMIT_EDGE_CLAIM
        CALL RET
        ITER_EDGES_BY_TYPE
        ITER_NODES_BY_TYPE
        ITER_INCIDENT_EDGES
        ITER_PROP_EQ
        ITER_NEXT
        ITER_EDGE_ROLE_NODES
      `,
      type: 'int float bool string'
    },

    contains: [
      {
        scope: 'comment',
        begin: /\bNOTE\b/,
        end: '$'
      },

      {
        scope: 'meta',
        begin: /^(SYMBOL)\b/
      },

      {
        scope: 'symbol',
        match: /^[A-Za-z_][A-Za-z0-9_]*:/
      },

      hljs.QUOTE_STRING_MODE,
      hljs.NUMBER_MODE,

      {
        scope: 'operator',
        match: /=/
      }
    ]
  };
});
