Skip to content

Grammar railroad diagram #6

Description

@mingodad

I've just added this project grammar to https://mingodad.github.io/parsertl-playground/playground/ an Yacc/Lex compatible online editor/tester (select Mimosa http request parser from Examples then click Parse to see a parse tree for the content in Input source).

Notice that I've replaced right recursion by left recursion in some rules.

And here is an EBNF to generate a nice navigable railroad diagram:

//
// EBNF to be viewd at https://www.bottlecaps.de/rr/ui
//
// Copy and paste this at https://www.bottlecaps.de/rr/ui in the 'Edit Grammar' tab
// then click the 'View Diagram' tab.
//

request::=
	  method LOCATION PROTO_MAJOR PROTO_MINOR kvs

method::=
	  HEAD
	| GET
	| POST
	| PUT
	| DELETE
	| TRACE
	| OPTIONS
	| CONNECT
	| PATCH
	| PROPFIND
	| PROPPATCH
	| MKCOL
	| COPY
	| MOVE
	| LOCK
	| UNLOCK
	| MIMOSA_SYMLINK

kvs::=
	  kvs kv
	| /*%empty*/

kv::=
	  KEY_ACCEPT_ENCODING accept_encodings
	| KEY_CONNECTION VALUE_CONNECTION
	| KEY_COOKIE cookies
	| KEY_CONTENT_LENGTH VAL64
	| KEY_CONTENT_TYPE VALUE
	| KEY_HOST HOST PORT
	| KEY_HOST HOST
	| KEY_REFERRER VALUE
	| KEY_USER_AGENT VALUE
	| KEY_IF_MODIFIED_SINCE VALUE
	| KEY_DESTINATION VALUE
	| KEY_CONTENT_RANGE RANGE_UNIT RANGE_START RANGE_END RANGE_LENGTH
	| KEY_RANGE RANGE_UNIT '=' byte_range_set
	| KEY VALUE

accept_encodings::=
	  /*%empty*/
	| accept_encodings COMPRESS
	| accept_encodings IDENTITY
	| accept_encodings DEFLATE
	| accept_encodings GZIP
	| accept_encodings ZSTD
	| accept_encodings BR
	| accept_encodings SDCH

cookies::=
	  /*%empty*/
	| cookie
	| cookies ';' cookie

cookie::=
	  ATTR
	| ATTR '='
	| ATTR '=' VALUE

byte_range_set::=
	  byte_range
	| byte_range_set ',' byte_range

byte_range::=
	  VAL64 '-' VAL64
	| VAL64 '-'
	| '-' VAL64

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions