I've been doing the session recently. The development of Initiation Protocol (SIP) protocol, SIP is widely used in telecom VoIP, and is a protocol based on text grammar. The syntax specification for SIP is defined using ABNF. Students interested in SIP syntax please go to their augmented BNF for the SIP Protocol section. Augmented BNF for Syntax SPECIFICATIONS:ABNF itself is also a grammatical norm, ABNF form can be defined by its own, interested in children's shoes please refer to its 4th chapter "ABNF Definition of ABNF".
Therefore, if you want to do a SIP protocol stack, you first have a SIP parser, which belongs to the ABNF parser. Online Search ABNF Parser generator (ABNF parser generator) can search a lot. Of course, if from the perspective of compiling principles, we are more inclined to write a ABNF parser generator, because if we wrote it ourselves, later, even with open source generator, it will certainly have a more profound experience.
ABNF's grammar definition is very short, mainly divided into two parts, the core rules and the main part of the ABNF. The core rules are primarily the most basic symbolic definitions:
ALPHA =%x41-5a/%x61-7a; A-z/A-Z BIT = "0"/"1" CHAR =%x01-7f;
Any 7-bit us-ascii character, excluding NUL CR =%x0d ; Carriage return CRLF = CR LF; Internet Standard NewLine CTL =%x00-1f/%x7f; Controls DIGIT =%x30-39; 0-9 dquote =%x22;
"(Double Quote) Hexdig = DIGIT/" A "/" B "/" C "/" D "/" E "/" F "Htab =%x09 ; Horizontal tab LF =%x0a; linefeed lwsp = * (Wsp/crlf WSP); Linear white spaces (past newline) octet =%x00-ff; 8 bits of data
SP =%x20; Space Vchar =%x21-7e; Visible (printing) characters WSP = Sp/htab; White spaces