presentations

Presentations
Log | Files | Refs

syntax (1195B)


      1 # <<syntax>>
      2 * Appendix 1 - PSYC Syntax
      3 
      4 Syntaxes in this section are described in Augmented Backus-Naur Form (ABNF).
      5 
      6 *PACKET SYNTAX*
      7 
      8 #+BEGIN_SRC abnf
      9 packet	= routing-header [ content-length content ] "|" LF
     10 ; the length of content is either implicit
     11 ; (scan until LF "|" LF)
     12 ; or explicitly reported in content-length.
     13 
     14 routing-header	= *routing-modifier
     15 entity-header	= *sync-operation *entity-modifier
     16 content		= entity-header [ body LF ]
     17 content-length	= [ length ] LF
     18 
     19 routing-modifier= operator variable ( simple-arg / LF )
     20 sync-operation  = ( "=" LF / "?" LF )
     21 entity-modifier = operator variable entity-arg
     22 entity-arg	= simple-arg / binary-arg / LF
     23 
     24 body		= method [ LF data ]
     25 
     26 operator	= "=" / ":" / "+" / "-" / "?" / "!" / "@"
     27 simple-arg	= HTAB text-data LF
     28 binary-arg	= SP length HTAB binary-data LF
     29 
     30 length		= 1*DIGIT
     31 binary-data	= *OCTET
     32 		; a length byte long byte sequence
     33 
     34 method		= 1*kwchar
     35 variable	= 1*kwchar
     36 text-data	= *nonlchar
     37 
     38 data		= *OCTET
     39 		; amount of bytes as given by length or until
     40 		; an (LF "|" LF) sequence has been encountered
     41 
     42 nonlchar	= %x00-09 / %x0B-FF
     43 		; any byte except \n
     44 kwchar		= %x30-39 / %x41-5A / %x61-7A / "_"
     45 		; alphanumeric or _
     46 #+END_SRC