Updated 2018-03-27 04:34:24 by pooryorick

A parser is a routine or program that analyses the structure of some input according to a formal grammar.

Examples would be various XML parsers, a BibTeX parser, and the parser for Tcl itself.

See Also  edit

command options
grammatical analysis
Scripted Parsing
Static syntax analysis
Techniques for reading and writing application configuration files

Description  edit

Almost all programs include parsers - at least if they read a file and process it to perform a (possibly useful) action. Excel, Word, OpenOffice, Photoshop and so on all contain parsers.

Now-a-days parsers are most often generated directly from grammar specifications instead of written by hand. Applications for doing so are called parser generators.

Tcl Script Parsers  edit

parsetcl, by Lars H
a community favorite
ptparser, by Salvatore Sanfilippo
comes from the Sugar macro system, but can be useful alone.
A Tcl parser in Tcl, by George Peter Staplin
an extension written in C (part of TclPro), is a lightweight wrapper around core parsing routines
includes IDETclParser for Tcl scripts. used for syntax highlighting and checking
Naive Tcl parser, by Colin McCormack
A branch of Tcl that adds tcl::parsecommand, tcl::parseexpr.
includes a set of Tcl_Parse*() functions
ships with the core, in Tcltest (see definition of TestparserObjCmd in generic/tclTest.c, and tests/parse.test). This doesn't seem to be well exposed for use in scripts, though it is used for testing the core parsing routines
The dgp-refactor branch
contains improvements to the Tcl parser that eliminate quadratic reparsing of every nested script, and produce complete parse trees.
scriptSplit, cmdSplit, and wordparts
not full parsers, but useful for splitting scripts, commands and words into their components.
ycl parse tcl stream, by PYK
Incrementally parse a Tcl script from a channel.

Other Parsers  edit

A little Slashdot comment parser
A little XML parser
A partial APL parser
BibTeX parser
C-header Parser
Cloverfield - Parser
Operator precedence expression parser
Parse Parenthesis
Parse Quote
Parsing an iPhoto catalog
Parsing C
Parsing Excel XLSX
parsing expressions, by SS
a Tcl prototype for a compiler written in C to turn mathematical expressions into bytecode for a stack-based machine
Parsing HTML
Parsing ISO8601 dates and times
parsing Mac OS X preferences using the 'defaults' command
Parsing PDF
Parsing Polish notation
Parsing RFC 1036 headers
Parsing RFC2822 dates and times
Parsing SQL
Reading and parsing RFC 822 headers
Regexp HTML Attribute Parsing
SNMP parser
Stephen Uhler's HTML parser in 10 lines
An extension, written in C, that lets Tcl scripts access Tcl's own parser via the parse command.
URL Parser
Visual Studio 2003 .sln file parser
XML Shallow Parsing with Regular Expressions
YAXMLP an XML parser