parser

Difference between version 28 and 30 - Previous - Next
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 **

   [command options]:   

   [grammatical analysis]:   
   
   [Scripted Parsing]:   

   [Static syntax analysis]:   

   [Techniques for reading and writing application configuration files]:   



** Description **

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 generator]s.


** Tcl Script Parsers **

   [http://www.doxygen.nl/%|%doxygen]:   Includes a parser by [René Zaumseil].

   [https://github.com/eclipse/dltk.tcl/blob/master/tcl/plugins/org.eclipse.dltk.tcl.parser/src/org/eclipse/dltk/tcl/parser/TclParser.java%|%Eclipse]:   Includes a parser written in [Java].

   [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]:   

   [tclparser]:   an extension written in [C] (part of [TclPro]), is a lightweight wrapper around core parsing routines

   [XotclIDE]:   includes IDETclParser for Tcl scripts.  used for syntax highlighting and checking

   [Naive Tcl parser], by [Colin McCormack]:   

   [https://chiselapp.com/user/pspjuth/repository/tcl/artifact?filename=parse.txt&ci=spjuth-parse%|%spjuth-parse]:   A branch of [Tcl] that adds `tcl::parsecommand`, `tcl::parseexpr`.

   [Tcl C API]:   includes a set of `Tcl_Parse*()` functions

   [testparser]:   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 [http://core.tcl.tk/tcl/timeline?r=dgp-refactor%|%dgp-refactor] branch:   contains improvements to the Tcl parser that eliminate quadratic reparsing of every nested script, and produce complete parse trees.

   [cmdSplit%|%scriptSplit, cmdSplit, and wordparts]:   not full parsers, but useful for splitting scripts, commands and words into their components.

   [ycl%|%ycl parse tcl stream], by [PYK]:   Incrementally parse a Tcl script from a [chan%|%channel].

** Other Parsers **
   *   Tcllib 1: Aycock-Horspool-Earley - https://core.tcl-lang.tkorg/tcllib/doc/trunk/embedded/wwwmd/tcllib/files/modules/grammar_aycock/aycock.htmld
   *   Tcllib 2: '''pt''' (PEG based) - https://core.tcl-lang.tkorg/tcllib/doc/trunk/embedded/wwwmd/tcllib/files/modules/pt/pt_introduction.htmld

   *   [Marpa/Tcl]

   [A little Slashdot comment parser]:   

   [A little XML parser]:   

   [A partial APL parser]:   

   [BibTeX parser]:   

   [C-header Parser]:   

   [Cloverfield - Parser]:   

   [LogParser]:   

   [Operator precedence expression parser]:   

   [Parse Parenthesis]:   

   [Parse Quote]:   

   [parseQif]:   

   [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]:   

   [tclparser]:   An extension, written in [C], that lets Tcl scripts access Tcl's own parser via the `parse` command.

   [tmpl_parser]:   

   [URL Parser]:   

   [Visual Studio 2003 .sln file parser]:   

   [XML Shallow Parsing with Regular Expressions]:   

   [YAXMLP an XML parser]:   
   [https://github.com/bef/enotcl%|%Tcl parser for the eno notation language]:   



<<categories>> Glossary | Concept | Parsing