Mirror of the Rel4tion website/wiki source, view at <http://rel4tion.org>

[[ 🗃 ^yEzqv rel4tion-wiki ]] :: [📥 Inbox] [📤 Outbox] [🐤 Followers] [🤝 Collaborators] [🛠 Commits]

Clone

HTTPS: git clone https://vervis.peers.community/repos/yEzqv

SSH: git clone USERNAME@vervis.peers.community:yEzqv

Branches

Tags

master :: projects / idan /

definition.mdwn

This page is going to be a specification of the Idan language. I’m not following any specific strict rules here - just trying to define things in an accurate unambiguous way.

Grammar Notation

See [[/grammar-notation]].

Encoding

The latest Unicode version at the time of writing is 7, and that is the version assumed for Idan.

Idan files must be encoded in UTF-8.

Resources

Context-Free Grammar (for parser)

TODO

Lexical Structure (for lexer)

The lexical structure defines how characters can be combined into lexemes by matching regular expressions. The lexemes are the alphabet for the grammar itself. Some of the definitions here are based on definitions used by formal documents of Haskell, Turtle and XML.

[[!format sgn """

document = (lexeme | whitespace) + lexeme = literal | generator | reference | anchor | punctuation | nesting | word

literal = uid | value

uid = uidopen uidbody uidclose uidopen = “<” uidclose = “>” uidbody =

value = boolean | number | character | string | chunk

boolean       = "[_]" | "[x]"

number        = integer | rational | float
  integer       = sign? natural
  rational      = sign? natural "/" natural
  float         = sign? floatbase floatexp?

  natural       = decimal
                | ("0o" | "0O") octal
                | ("0x" | "0X") hexadecimal
                | ("0b" | "0B") binary
  floatbase     = decimal | decimal "." decimal
  floatexp      = "$" sign? decimal

  decimal       = digit+
  octal         = octit+
  hexadecimal   = hexit+
  binary        = binit+

  binit         = [0-1]
  octit         = [0-7]
  digit         = ascdigit | unidigit
  ascdigit      = [0-9]
  unidigit      = / any Unicode decimal digit /
  hexit         = digit | [a-fA-F]
  sign         = "-" | "+"

character     = rcharacter | scharacter | ncharacter
  rcharacter     = rchardelim rchar rchardelim
    rchardelim     = "'"
    rchar          = graphical - (rchardelim | escstart) | escape
  scharacter     = schardelim space* schar space* schardelim
    schardelim     = "'''"
    schar          = graphical - space
  ncharacter     = nchardelim nchar nchardelim
    nchardelim     = "`"
    nchar          = charname
  escape        = escstart (charesc | numesc)
    escstart      = "\"
    charesc       = [abfnrtv] | rchardelim | escstart
    numesc        = decimal | "o" octal | "x" hexadecimal
  charname          = ([a-zA-Z0-9] | [-_] | space)+

string        = q1string | q3string
  q1string      = q1delim q1body q1delim
    q1delim       = '"'
    q1body        = ( q1char | q1esc )*
      q1char        = graphical - ( q1delim | escstart)
  q3string      = q3delim q3body q3delim
    q3delim       = '"""'
    q3body        =
  q1esc = escstart ( baseesc | q1delim )
  q3esc = escstart ( baseesc | q3delim )
  baseesc = [abfnrtv&] | escstart

chunk         = chunkdelim chunkbody chunkdelim
  chunkdelim    = "||"
  chunkbody     = whitespace? (chunkblock whitespace?)+ chunkend
    chunkblock    = base64char +
      base64char    = [A-Za-z0-9+/]
    chunkend      = base64pad whitespace?
      base64pad      = "=" #0-2

generator = uidopen generatorsym uidclose generatorsym = “%”

reference = arrowref | subjref | idref | nsref | labelref | anchorref arrowref = arrowrefsym refptr subjref = subjrefsym refptr idref = idrefsym refptr nsref = nsrefsym nsprefix labelref = nsprefix? (“:” reslabel)+ anchorref = anchorrefsym anchorlabel

arrowrefsym = “$” subjrefsym = “#” idrefsym = “!” nsrefsym = “@” anchorrefsym = “&”

refptr = arrowseq | arrowcount arrowseq = arrowupseq | arrowdownseq arrowupseq = arrowup+ arrowdownseq = arrowdown+ arrowcount = arrow count arrow = arrowup | arrowdown arrowup = “^” arrowdown = “,” count = nsprefix = reslabel =

anchor = anchorsym anchorlabel anchorsym = “=” anchorlabel =

punctuation = predsep | objsep | stmtsep predsep = “;” objsep = “,” stmtsep = “.”

nesting = nestopen | nestclose nestopen = “[" nestclose = "]”

word =

whitespace = whitepart + whitepart = whitechar | comment whitechar = newline | vertab | space | tab | uniwhite newline = return linefeed | return | linefeed | formfeed tab = 9 linefeed = vertab = formfeed = return = space = 20 uniwhite = / any Unicode character defined as whitespace /

comment = slcomment | mlcomment slcomment = dashes linechar* newline linechar = graphical | tab graphic = / any unicode character with basic type Graphical / dashes = slcstart “-” slcstart = “–” mlcomment = mlopen mlseq? (mlcomment mlseq) mlclose mlcopen = “{-” mlcclose = “-}” mlseq = mlchar* - (mlchar* ( mlopen | mlclose ) mlchar*) mlchar = graphical | whitechar

"""]]

[See repo JSON]