Skip to content

Grammar

What follows is a rough rendition of the Lama2 grammar, followed by a visual exploration of the grammar in the railroad diagram format (thanks to Railroad Diagram Generator)

EBNF Description

Lama2File       ::= (Proceessor Separator)? Requestor (Separator Processor Separator Requestor)*
Separator       ::= `^---$`
Processor       ::= `(?!(get|post|head|put|delete|connect|trace|patch))`
Requestor       ::= HTTPVerb Multipart? TheURL Details?
HTTPVerb        ::= "get" | "head" | "post" | "put" | "delete" | "connect" | "trace" | "patch"
Multipart       ::= "multipart"
TheURL          ::= "http" "s"? "://" [A-Za-z0-9-._~:/?#[@!$&'()*+,;%=]+ /* ws: explicit */
Details         ::= HeaderData | DataHeader

HeaderData      ::= Headers DataInput?
DataHeader      ::= DataInput Headers?
Headers         ::= HeaderPair HeaderPair*
HeaderPair      ::= (QuotedString | Unquoted) ":" (QuotedString | Unquoted)
DataInput       ::= VarJSON | JSONType

VarJSON         ::= VarJSONPair VarJSONPair* FilesPair?
VarJSONPair     ::= (QuotedString | VarJSONUnquoted) "=" (QuotedString | VarJSONUnquoted)
FilesPair       ::= FilesPair FilesPair*
FilesPair       ::= (QuotedString | FilesUnquoted) "@" (QuotedString | FilesUnquoted)
VarJSONUnquoted ::= [@0-9A-Za-z \t!$%&()*+./;<>?^_`|~-]+ /* ws: explicit */
FilesUnquoted   ::= [0-9A-Za-z \t!$%&()*+./;<>?^_`|~-]+ /* ws: explicit */
QuotedString    ::= ['"] Char* ['"]
Unquoted        ::= [0-9A-Za-z \t!$%&()*+./;<=>?^_`|~-]+ /* ws: explicit */


JSONType        ::= ComplexType | PrimitiveType
ComplexType     ::= List | Map
PrimitiveType   ::= Null | Boolean | QuotedString | Number
Map             ::= "{" Pair? (Pair ",")* "}"
List            ::= "[" JSONType? (JSONType ",")* "]"
Pair            ::= QuotedString ":" JSONType

Boolean         ::= "true" | "false"
Null            ::= "null"


Number          ::= Integer Fraction? Exponent?
Exponent        ::= [eE] Sign? Digits
Fraction        ::= "." Digits
Integer         ::= IntegerRule4 | IntegerRule3 | IntegerRule2 | IntegerRule1

IntegerRule1    ::= Digit
IntegerRule2    ::= OneNine Digits
IntegerRule3    ::= Sign IntegerRule1
IntegerRule4    ::= Sign IntegerRule2

Digits          ::= Digit Digit*
Digit           ::= "0"? OneNine
OneNine         ::= [1-9]
Sign            ::= [-+]

Railroad Diagram


Lama2File:

Proceessor Separator Requestor Separator Processor Separator

no references


Separator:

---

         ::= '---'

referenced by:


Processor:

(?!(get|post|head|put|delete|connect|trace|patch))

         ::= '(?!(get|post|head|put|delete|connect|trace|patch))'

referenced by:


Requestor:

HTTPVerb Multipart TheURL Details

         ::= HTTPVerb Multipart? TheURL Details?

referenced by:


HTTPVerb:

get head post put delete connect trace patch

HTTPVerb ::= 'get'
           | 'head'
           | 'post'
           | 'put'
           | 'delete'
           | 'connect'
           | 'trace'
           | 'patch'

referenced by:


Multipart:

multipart

         ::= 'multipart'

referenced by:


TheURL:

http s :// [A-Z] [a-z] [0-9] - . _ ~ : / ? # [ @ ! $ & ' ( ) * + , ; % =

TheURL   ::= 'http' 's'? '://' [A-Za-z0-9._~:/?[@!$&'()*+,;%=#x2D#x23]+
          /* ws: explicit */

referenced by:


Details:

HeaderData DataHeader

           | DataHeader

referenced by:


HeaderData:

Headers DataInput

         ::= Headers DataInput?

referenced by:


DataHeader:

DataInput Headers

         ::= DataInput Headers?

referenced by:


Headers:

HeaderPair

referenced by:


HeaderPair:

QuotedString Unquoted : QuotedString Unquoted

         ::= ( QuotedString | Unquoted ) ':' ( QuotedString | Unquoted )

referenced by:


DataInput:

VarJSON JSONType

         ::= VarJSON
           | JSONType

referenced by:


VarJSON:

VarJSONPair FilesPair

referenced by:


VarJSONPair:

QuotedString VarJSONUnquoted = QuotedString VarJSONUnquoted

referenced by:


FilesPair:

FilesPair QuotedString FilesUnquoted @ QuotedString FilesUnquoted

         ::= FilesPair FilesPair*
           | ( QuotedString | FilesUnquoted ) '@' ( QuotedString | FilesUnquoted )

referenced by:


VarJSONUnquoted:

@ [0-9] [A-Z] [a-z] \ t ! $ % & ( ) * + . / ; < > ? ^ _ ` | ~ -

         ::= [@0-9A-Za-z \t!$%&()*+./;<>?^_`|~#x2D]+
          /* ws: explicit */

referenced by:


FilesUnquoted:

[0-9] [A-Z] [a-z] \ t ! $ % & ( ) * + . / ; < > ? ^ _ ` | ~ -

         ::= [0-9A-Za-z \t!$%&()*+./;<>?^_`|~#x2D]+
          /* ws: explicit */

referenced by:


QuotedString:

' " Char ' "

         ::= ['"] Char* ['"]

referenced by:


Unquoted:

[0-9] [A-Z] [a-z] \ t ! $ % & ( ) * + . / ; < = > ? ^ _ ` | ~ -

Unquoted ::= [0-9A-Za-z \t!$%&()*+./;<=>?^_`|~#x2D]+
          /* ws: explicit */

referenced by:


JSONType:

ComplexType PrimitiveType

           | PrimitiveType

referenced by:


ComplexType:

List Map

         ::= List
           | Map

referenced by:


PrimitiveType:

Null Boolean QuotedString Number

         ::= Null
           | Boolean
           | QuotedString
           | Number

referenced by:


Map:

{ Pair Pair , }

Map      ::= '{' Pair? ( Pair ',' )* '}'

referenced by:


List:

[ JSONType JSONType , ]

List     ::= '[' JSONType? ( JSONType ',' )* ']'

referenced by:


Pair:

QuotedString : JSONType

Pair     ::= QuotedString ':' JSONType

referenced by:


Boolean:

true false

Boolean  ::= 'true'
           | 'false'

referenced by:


Null:

null

Null     ::= 'null'

referenced by:


Number:

Integer Fraction Exponent

referenced by:


Exponent:

e E Sign Digits

Exponent ::= [eE] Sign? Digits

referenced by:


Fraction:

. Digits

Fraction ::= '.' Digits

referenced by:


Integer:

IntegerRule4 IntegerRule3 IntegerRule2 IntegerRule1

           | IntegerRule3
           | IntegerRule2
           | IntegerRule1

referenced by:


IntegerRule1:

Digit

         ::= Digit

referenced by:


IntegerRule2:

OneNine Digits

         ::= OneNine Digits

referenced by:


IntegerRule3:

Sign IntegerRule1

         ::= Sign IntegerRule1

referenced by:


IntegerRule4:

Sign IntegerRule2

         ::= Sign IntegerRule2

referenced by:


Digits:

Digit

Digits   ::= Digit Digit*

referenced by:


Digit:

0 OneNine

Digit    ::= '0'? OneNine

referenced by:


OneNine:

[1-9]

OneNine  ::= [1-9]

referenced by:


Sign:

- +

Sign     ::= [-+]

referenced by:



  ... generated by RR - Railroad Diagram Generator R R