Introduction of ABNF grammar based on predictive parsing

Source: Internet
Author: User
Tags definition generator

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.