Appendix A
FeBe Protocol Syntax


Metasyntax

This document specifies the FeBe Protocol in an extended Backus - Naur Form (BNF) strongly influenced by [Harbison&Steele 84].

Terminal symbols are printed using a fixed typeface, while non-terminal symbols are written in cursive style. All terminal symbols refers to ASCII characters to be sent exactly as defined within the open and close quotes (` ').

All non-terminal symbols are defined by a production. The vertical bar (|) designates an exclusive-or choice between options. The production: non-terminal ::= `terminal' | also-non-terminal defines the symbol non-terminal as either the terminal symbol terminal or the non-terminal symbol also-non-terminal. The symbol `|' has lower precedence than all operators except `::=' and `Þ'.

Sequences

The brackets `[' and `]' are used as meta-syntactical symbols to designate optional and/or repeating sequences. [ symbol ]? zero or one occurrence of symbol

[ symbol ]* zero or more occurrences of symbol

[ symbol ]+ one or more occurrences of symbol
The FeBe Protocol also uses a sequence construct difficult to model in BNF: a count delimited sequence. We introduce an extension to the syntax: count * [ element ] to designate the number count followed by count repetitions of element.

Calls

The arrow `Þ' specifies a protocol call: call Þ result | error Although this looks like a production it is in reality an action. The above example is a call from Fe (call) with a reply from the Be (result) or possibly an error (error).

 

Lexical Definitions

Special Characters newline ::= This is the character 128 or A16 often represented as '\n' in C.

delim ::= `~' | newline

digit
::= `0' | `1' | `2' | `3' | `4' | `5' | `6' | `7' | `8' | `9'

char ::= Any 8 bit ASCII character
Errors error ::= `?' Tumblers number ::= [ digit ]+ delim

exponent
::= [ digit ]+

tumbler ::= exponent [ `.' [ digit ]+ ]* delim

id
::= tumbler

vaddr
::= exponent `.' [ digit ]+ [ `.' [ digit ]+ ]? delim
Groups span ::= tumblerstart tumblerwidth

vspan
::= vaddrstart vaddrwidth

spec
::= `s' delim span

| `v' delim doc-id number * [ vspan ]

spec-set ::= number * [ spec ]

shared-span ::= tumblerstart-1 tumblerstart -2 tumblerwidth

 
Document contents string ::= `t' number * [ char ]

contents ::= string | idlink
Command codes create-new-document ::= `11' delim

create-new-version
::= `13' delim

open
::= `35' delim

close
::= `36' delim

create-link
::= `27' delim

retrieve-doc-vspan
::= `14' delim

retrieve-doc-vspanset
::= `1' delim

retrieve-v
::= `5' delim

follow-link
::= `18' delim

retrieve-endsets
::= `28' delim

find-links-from-to-three
::= `30' delim

show-relations-of-2-versions
::= `10' delim

find-docs-containing
::= `22' delim

insert
::= `0' delim

copy
::= `2' delim

rearrange
::= `3' delim

delete-vspan
::= `12' delim

quit
::= `16' delim

x-account
::= `34' delim

create-node-or-account
::= `38' delim

 
Requests

create-new-document 11 create-new-document Þ create-new-document iddoc| error create-new-version 13 create-new-version idold-doc Þ create-new-version idnew-doc| error open 35 mode ::= `1'read-only delim | `2'read-write delim

copy-switch
::= `1'fail-on-conflict delim | `2'copy-on-conflict delim | `3'always-copy

open iddoc mode copy-switch Þ open idnew-doc | error
close 36 close iddoc Þ close | error create-link 27 create-link iddoc spec-setfrom spec-setto spec-setthree

Þ create-link idlink | error
retrieve-doc-vspan 14 retrieve-doc-vspan iddoc Þ retrieve-doc-vspan vspan | error retrieve-doc-vspanset 1 retrieve-doc-vspanset iddoc Þ retrieve-doc-vspanset number * [ vspan ]

| error
retrieve-v 5 retrieve-v spec-set Þ retrieve-v number * [ contents ] | error follow-link 18 end-switch ::= `1'from delim | `2'to delim | `3'three delim

follow-link end-switch id
link
Þ follow-link spec-setend | error
retrieve-endsets 28 retrieve-endsets spec-setcontents Þ retrieve-endsets spec-setfrom spec-setto

spec-setthree
| error
find-links-from-to-three 30 home-spec ::= number * [ iddoc]

find-links-from-to-three spec-set
from spec-setto spec-setthree home-spec Þ

find-links-from-to-three number * [ idlink ]

| error
show-relations-of-2-versions 10 show-relations-of-2-versions spec-set1 spec-set2 Þ

show-relations-of-2-versions number * [ shared-span ]

| error
find-docs-containing 22 find-docs-containing spec-set Þ find-docs-containing number * [ iddoc ]

| error
insert 0 insert iddoc vaddr number * [ string ] Þ insert | error copy 2 copy iddoc vaddr spec-set Þ copy | error ii.rearrange; 3 cut-count ::= `2' delim | `3' delim | `4' delim

rearrange iddoc
cut-count * [ vaddr ] Þ rearrange | error
delete-vspan 12 delete-vspan iddoc vspan Þ delete-vspan | error quit 16 quit Þ quit (The quit call can't return error.) x-account 34 x-account idaccount Þ x-account | error create-node-or-account 38 create-node-or-account idaccountÞ create-node-or-account idaccount

| error