mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 09:40:21 +00:00
Extended Backus–Naur form ([EBNF][]) is a metalanguage used to specify language grammars. [EBNF]: https://en.wikipedia.org/wiki/Extended_Backus–Naur_form
25 lines
717 B
EBNF
25 lines
717 B
EBNF
(*
|
|
Source: https://github.com/sunjay/lion
|
|
License: MIT
|
|
*)
|
|
|
|
Statement = ( NamedFunction | AnonymousFunction | Assignment | Expr ) , "\n" ;
|
|
Expr = AnonymousFunction | Term | "(" , Expr , ")" ,
|
|
{ AnonymousFunction | Term | "(" , Expr , ")" } ;
|
|
|
|
Assignment = Symbol , "=" , Expr ;
|
|
|
|
AnonymousFunction = "\" , FunctionRHS ;
|
|
NamedFunction = Symbol , FunctionRHS ;
|
|
|
|
FunctionRHS = FunctionParams , "=" , FunctionBody ;
|
|
FunctionParams = FunctionParam , { FunctionParam } ;
|
|
FunctionParam = Term ;
|
|
FunctionBody = Expr ;
|
|
|
|
Term = Symbol | Number | SingleWordString ;
|
|
SingleWordString = '"' , Symbol , '"' ;
|
|
(* Symbol is a collection of valid symbol characters, not defined here *)
|
|
(* Number is a valid numeric literal *)
|
|
|