Methods and variables of PSYC use keywords. They follow a common syntax and behaviour as follows.


Protocol Keywords

This document describes the keyword naming strategy and syntax as used by PSYC.

All keywords used as method name of a Packet have a special syntax. This syntax allows generic treatment of specialized methods.


Keywords consist of ASCII characters and have the following syntax:

  keyword          = 1*short-subkeyword *long-subkeyword
                   =/ 1*long-subkeyword
  short-subkeyword = printchar
  long-subkeyword  = "_" 1*alphanumeric
  alphanumeric     = %x30-39 / %x41-5A / %x61-7A 
                      ; The ASCII characters 0-9, a-z and A-Z
  printchar        = <see Spec:Packet for definition of printchar>


This is a long form of a keyword: _reply_error_invalidTarget_noSuchObject. And the short form for it is: reto

Keywords can also be mixed: ret_invalidNamingSyntaxForThisSite.

Short vs. Long Forms

All keywords defined within this specification have a short form and a long form. However, some special or experimental keywords don't have short forms until they are standardized.

All implementations MUST accept both forms for the keywords defined in this specification.

It is recommended to only pass long forms to applications in programmer APIs, so that short forms stay a simple protocol level optimization. Thus, mapping from short forms to long forms should happen right after parsing.

Keyword inheritance

A keyword consists of a hierarchical set of subkeywords. The meaning of the keyword becomes more precise with the number of additional subkeywords appended to its tail.

That means that the receiver of an unknown keyword can strip off subkeywords from the end of the keyword until it recognizes it. With this the receiver can process the packet by only using the known part of the keyword. This implements a form of semantic inheritance that we call keyword inheritance.


A practical implementation of a validity check in an opcode language like perl or LPC is to use a simple regular expression. Here's the definition in LPC:

#define legal_keyword(WORD)     (!regmatch(WORD, "[^_0-9A-Za-z]"))

See inheritance and psycmatch for implementations of behaviour based on subkeywords.