headerphoto

ABNF Parser Generator

SIP

For many companies Session Initiation Protocol (SIP) has become the chosen protocol for enterprise-wide Internet session management. From RFC 3261: "There are many applications of the Internet that require the creation and management of a session, where a session is considered an exchange of data between an association of participants. ... SIP is an agile, general-purpose tool for creating, modifying, and terminating sessions that works independently of underlying transport protocols and without dependency on the type of session that is being established."

This is a modified version of the grammar given in RFC 3261. All of the original rule definitions are kept as comments where changes have been made. Of note is the change for the "hostname", "domainlabel" and "toplabel" combination. These presented a particularly interesting challenge to the prioritized-choice rule. (See tutorial 6.) While the "hostname" rule is a valid context-free grammar expression, it cannot be parsed with the prioritized-choice rule. The rules for "domainlabel" and "toplabel" can be resolved, but the "hostname" rule required the use of syntactic predicates for resolution.

With 313 rules, this is a rather large grammar. One of the reasons for choosing it was to stress test the browser/JavaScript environment. Be patient after clicking Generate. You may see some sort of "Script not responding" message. Clicking the "continue" option, if given, a sufficient number of times should result in a completed parse.

ABNF Grammar:   X

SIP Input

This parser should correctly parse all of the valid SIP messages from the "Torture Test" test suite found in RFC 4475. Several of them contain non-ASCII characters and are given here in "hex" Input Mode.

Input String:   X

Parser Output: