Skip to content

Instantly share code, notes, and snippets.

@joeltg
Last active October 9, 2021 04:25
Show Gist options
  • Save joeltg/f68d1d379d265fd6344c5c179854cb0a to your computer and use it in GitHub Desktop.
Save joeltg/f68d1d379d265fd6344c5c179854cb0a to your computer and use it in GitHub Desktop.
tasl = *( block newline ) block
block = *WSP [ line-comment / statement *WSP ]
statement = namespace-definition
/ literal-definition
/ class-declaration
keyword-namespace = %x6E.61.6D.65.73.70.61.63.65
keyword-literal = %x6C.69.74.65.72.61.6C
keyword-class = %x63.6C.61.73.73
namespace-definition = keyword-namespace 1*WSP identifier 1*WSP namespace-uri
literal-definition = keyword-literal 1*WSP identifier 1*WSP term
class-declaration = keyword-class 1*WSP term 1*WSP 1*WSP type
type = identifier ; type variable
/ reference ; reference type
/ uri ; uri type
/ product ; product type
/ coproduct ; coproduct type
uri = "<>"
reference = "*" *WSP term
product = "{" [ *WSP newline components ] *WSP "}"
components = *( *WSP [ line-comment / component *WSP ] newline )
component = term 1*WSP "->" 1*WSP type
coproduct = "[" [ *WSP newline options ] *WSP "]"
options = *( *WSP [ line-comment / option *WSP ] newline )
option = term 1*WSP "<-" 1*WSP type
term = identifier ":" 1*( pchar / "/" / "?" )
namespace-uri = absolute-uri ( "/" / "?" / "#" )
absolute-uri = scheme ":" ( "//" authority / [ "/" ] 1*pchar ) *( "/" 1*pchar )
identifier = ALPHA *(ALPHA / DIGIT)
newline = LF / CRLF
line-comment = "#" *(WSP / VCHAR)
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
hier-part = "//" authority path-abempty
/ path-absolute
/ path-rootless
/ path-empty
URI-reference = URI / relative-ref
absolute-URI = scheme ":" hier-part [ "?" query ]
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
relative-part = "//" authority path-abempty
/ path-absolute
/ path-noscheme
/ path-empty
scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
authority = [ userinfo "@" ] host [ ":" port ]
userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
host = IP-literal / IPv4address / reg-name
port = *DIGIT
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
IPv6address = 6( h16 ":" ) ls32
/ "::" 5( h16 ":" ) ls32
/ [ h16 ] "::" 4( h16 ":" ) ls32
/ [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
/ [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
/ [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
/ [ *4( h16 ":" ) h16 ] "::" ls32
/ [ *5( h16 ":" ) h16 ] "::" h16
/ [ *6( h16 ":" ) h16 ] "::"
h16 = 1*4HEXDIG
ls32 = ( h16 ":" h16 ) / IPv4address
IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
dec-octet = DIGIT ; 0-9
/ %x31-39 DIGIT ; 10-99
/ "1" 2DIGIT ; 100-199
/ "2" %x30-34 DIGIT ; 200-249
/ "25" %x30-35 ; 250-255
reg-name = *( unreserved / pct-encoded / sub-delims )
path = path-abempty ; begins with "/" or is empty
/ path-absolute ; begins with "/" but not "//"
/ path-noscheme ; begins with a non-colon segment
/ path-rootless ; begins with a segment
/ path-empty ; zero characters
path-abempty = *( "/" segment )
path-absolute = "/" [ segment-nz *( "/" segment ) ]
path-noscheme = segment-nz-nc *( "/" segment )
path-rootless = segment-nz *( "/" segment )
path-empty = 0<pchar>
segment = *pchar
segment-nz = 1*pchar
segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" )
; non-zero-length segment without any colon ":"
pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
query = *( pchar / "/" / "?" )
fragment = *( pchar / "/" / "?" )
pct-encoded = "%" HEXDIG HEXDIG
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
reserved = gen-delims / sub-delims
gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment