From ee7a205bd8235255b652038bfef779744f3d93f5 Mon Sep 17 00:00:00 2001 From: Taylan Kammer Date: Sat, 14 Nov 2026 16:16:17 +0100 Subject: Rename to Xisp. --- doc/0/grammar/abnf.txt | 6 ++-- doc/0/grammar/index.md | 10 +++---- doc/0/grammar/peg.txt | 2 +- doc/0/grammar/xbnf.txt | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/0/grammar/zbnf.txt | 75 -------------------------------------------------- 5 files changed, 84 insertions(+), 84 deletions(-) create mode 100644 doc/0/grammar/xbnf.txt delete mode 100644 doc/0/grammar/zbnf.txt (limited to 'doc/0/grammar') diff --git a/doc/0/grammar/abnf.txt b/doc/0/grammar/abnf.txt index 5ab3c89..61a1db8 100644 --- a/doc/0/grammar/abnf.txt +++ b/doc/0/grammar/abnf.txt @@ -8,10 +8,10 @@ ; The abnfgen(1) tool linked above can be used to generate arbitrary ; strings matching the grammar in this file. These can be fed into -; the Zisp parser to reveal some potential bugs; either in the parser +; the Xisp parser to reveal some potential bugs; either in the parser ; itself, or this ABNF grammar. -; Note that the tool may generate Zisp string literals with Unicode +; Note that the tool may generate Xisp string literals with Unicode ; escape sequences corresponding to surrogate code points; the parser ; may reject these. This is expected; it's difficult to rewrite this ; ABNF grammar to exclude those Unicode values. @@ -21,7 +21,7 @@ ; fact the end-of-file may also terminate them; the same applies to ; hash-bang parsing which doesn't actually have to end in LF. These ; discrepancies won't make abnfgen(1) generate invalid strings; they -; only make this ABNF more strict than the Zisp parser, so it won't +; only make this ABNF more strict than the Xisp parser, so it won't ; generate some strings that the parser would actually accept. diff --git a/doc/0/grammar/index.md b/doc/0/grammar/index.md index e3716ea..1899b16 100644 --- a/doc/0/grammar/index.md +++ b/doc/0/grammar/index.md @@ -1,15 +1,15 @@ -# Zisp S-Expression Grammar +# Xisp S-Expression Grammar The grammar is available in several different formats: -* [ZBNF](zbnf.txt): See below for the rules of this notation +* [XBNF](xbnf.txt): See below for the rules of this notation * [ABNF](abnf.txt): Compatible with the `abnfgen` tool * [PEG](peg.txt): Compatible with `peg/leg` tool -## ZBNF notation +## XBNF notation -The ZBNF grammar specification uses a BNF-like notation with PEG-like +The XBNF grammar specification uses a BNF-like notation with PEG-like semantics: * Concatenation of expressions is implicit: `foo bar` means `foo` @@ -86,7 +86,7 @@ variables. The parser consumes one `Unit` from the input stream every time it's called; it returns the `Datum` therein if found, or else it returns -the Zisp EOF token. +the Xisp EOF token. Since a `Datum` is not self-terminating, the parser must read beyond it to realize that it has ended (if not followed by the EOF). Thus, diff --git a/doc/0/grammar/peg.txt b/doc/0/grammar/peg.txt index 1541da6..5ce0cd5 100644 --- a/doc/0/grammar/peg.txt +++ b/doc/0/grammar/peg.txt @@ -75,7 +75,7 @@ ALPHA <- [a-zA-Z] HEXDIG <- [0-9a-fA-F] -# Keep this in sync line-for-line with the ZBNF grammar for easy +# Keep this in sync line-for-line with the XBNF grammar for easy # comparison between the two. # This file is meant to be compatible with: diff --git a/doc/0/grammar/xbnf.txt b/doc/0/grammar/xbnf.txt new file mode 100644 index 0000000..c04b813 --- /dev/null +++ b/doc/0/grammar/xbnf.txt @@ -0,0 +1,75 @@ +; Custom notation with PEG semantics + +Stream : Unit ( Blank Unit )* + + +Unit : Blank* [Datum] + +Blank : '\t'...'\r' | SP | Comment + + +Datum : OneDatum ( [JoinChar] OneDatum )* + +JoinChar : '.' | ':' + + +Comment : ';' ( SkipUnit | SkipLine ) + +SkipUnit : '~' Unit + +SkipLine : ( ~LF )* [LF] + + +OneDatum : BareString | CladDatum + + +BareString : SpecBareChar ( BareChar | JoinChar )* + | BareChar+ + +SpecBareChar : '+' | '-' | JoinChar | DIGIT + +BareChar : ALPHA | DIGIT + | '!' | '$' | '%' | '&' | '*' | '+' | '-' | '/' + | '<' | '=' | '>' | '?' | '^' | '_' | '~' + + +CladDatum : PipeStr | QuoteStr | HashExpr | QuoteExpr | List + +PipeStr : '|' ( PipeStrChar | '\' StringEsc )* '|' +QuoteStr : '"' ( QuotStrChar | '\' StringEsc )* '"' +HashExpr : '#' HashExprs +QuoteExpr : "'" Datum | '`' Datum | ',' Datum +List : ParenList | SquareList | BraceList + + +PipeStrChar : ~( '|' | '\' ) +QuotStrChar : ~( '"' | '\' ) + +StringEsc : '\' | '|' | '"' | ( HTAB | SP )* LF ( HTAB | SP )* + | '0' | 'a' | 'b' | 't' | 'n' | 'v' | 'f' | 'r' | 'e' + | 'x' HexByte* ';' + | 'u' UnicodeSV ';' + +HexByte : HEXDIG HEXDIG +UnicodeSV : HEXDIG+ + + +HashExprs : '!' ( SP | HTAB )* HBangLine [ LF ] + | '%' Label ( '%' | '=' Datum ) + | '\' BareString | CladDatum + | Rune [ '\' BareString | CladDatum ] + +HBangLine : HBChars+ ( SP | HTAB )* [ HBChars+ ] +HBChars : ~( SP | HTAB | LF ) +Label : HEXDIG+ +Rune : ALPHA ( ALPHA | DIGIT )* + + +ParenList : '(' Unit* ')' +SquareList : '[' Unit* ']' +BraceList : '{' Unit* '}' + + +;; Local Variables: +;; eval: (flyspell-mode -1) +;; End: diff --git a/doc/0/grammar/zbnf.txt b/doc/0/grammar/zbnf.txt deleted file mode 100644 index c04b813..0000000 --- a/doc/0/grammar/zbnf.txt +++ /dev/null @@ -1,75 +0,0 @@ -; Custom notation with PEG semantics - -Stream : Unit ( Blank Unit )* - - -Unit : Blank* [Datum] - -Blank : '\t'...'\r' | SP | Comment - - -Datum : OneDatum ( [JoinChar] OneDatum )* - -JoinChar : '.' | ':' - - -Comment : ';' ( SkipUnit | SkipLine ) - -SkipUnit : '~' Unit - -SkipLine : ( ~LF )* [LF] - - -OneDatum : BareString | CladDatum - - -BareString : SpecBareChar ( BareChar | JoinChar )* - | BareChar+ - -SpecBareChar : '+' | '-' | JoinChar | DIGIT - -BareChar : ALPHA | DIGIT - | '!' | '$' | '%' | '&' | '*' | '+' | '-' | '/' - | '<' | '=' | '>' | '?' | '^' | '_' | '~' - - -CladDatum : PipeStr | QuoteStr | HashExpr | QuoteExpr | List - -PipeStr : '|' ( PipeStrChar | '\' StringEsc )* '|' -QuoteStr : '"' ( QuotStrChar | '\' StringEsc )* '"' -HashExpr : '#' HashExprs -QuoteExpr : "'" Datum | '`' Datum | ',' Datum -List : ParenList | SquareList | BraceList - - -PipeStrChar : ~( '|' | '\' ) -QuotStrChar : ~( '"' | '\' ) - -StringEsc : '\' | '|' | '"' | ( HTAB | SP )* LF ( HTAB | SP )* - | '0' | 'a' | 'b' | 't' | 'n' | 'v' | 'f' | 'r' | 'e' - | 'x' HexByte* ';' - | 'u' UnicodeSV ';' - -HexByte : HEXDIG HEXDIG -UnicodeSV : HEXDIG+ - - -HashExprs : '!' ( SP | HTAB )* HBangLine [ LF ] - | '%' Label ( '%' | '=' Datum ) - | '\' BareString | CladDatum - | Rune [ '\' BareString | CladDatum ] - -HBangLine : HBChars+ ( SP | HTAB )* [ HBChars+ ] -HBChars : ~( SP | HTAB | LF ) -Label : HEXDIG+ -Rune : ALPHA ( ALPHA | DIGIT )* - - -ParenList : '(' Unit* ')' -SquareList : '[' Unit* ']' -BraceList : '{' Unit* '}' - - -;; Local Variables: -;; eval: (flyspell-mode -1) -;; End: -- cgit v1.2.3