Skip to content

Instantly share code, notes, and snippets.

@nyuichi
Created March 15, 2011 08:20
Show Gist options
  • Save nyuichi/870455 to your computer and use it in GitHub Desktop.
Save nyuichi/870455 to your computer and use it in GitHub Desktop.
H-BNF
;;; Syntax Rules (in BNF)
;;;
;;; <program> ::= <main> | <definition> <program>
;;; <main> ::= <statement> <eof> | <statement> <main>
;;; <statement> ::= 's' | 'r' | 'l' | <call> | <parameter>
;;;
;;; <call> ::= <procname> | <procname> '(' <arguments> ')'
;;; <arguments> ::= <argument> | <argument> ',' <arguments>
;;; <argument> ::= <expression> | <body>
;;; <body> ::= <statement> <body> | ''
;;;
;;; <expression> ::= '-' <numeric> <succeed>
;;; <succeed> ::= <sign> <numeric> <succeed> | ''
;;; <sign> ::= '-' | '+'
;;; <numeric> ::= <number> | <parameter>
;;;
;;; <definition> ::= <prototype> ':' <body> <endline>
;;; <prototype> ::= <procname> | <procname> '(' <parameters> ')'
;;; <parameters> ::= <parameter> | <parameter> ',' <parameters>
;;;
;;; <procname> ::= <lowercase>
;;; <parameter> ::= <uppercase>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment