emacs.d/clones/lisp/www.cliki.net/parseq.html

97 lines
5.3 KiB
HTML
Raw Normal View History

2022-10-07 15:47:14 +02:00
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>CLiki: parseq</title>
<link rel="alternate" type="application/atom+xml" title="ATOM feed of edits to current article"
href="https://www.cliki.net/site/feed/article.atom?title=parseq">
<link rel="stylesheet" href="static/css/style.css">
<link rel="stylesheet" href="static/css/colorize.css">
</head>
<body>
<span class="hidden">CLiki - parseq</span>
<div id="content"><div id="content-area"><div id="article-title">parseq</div><div id="article">A <a href="parser&#32;generator.html" class="category">parser generator</a> for common lisp, inspired by <a href="ESRAP.html" class="category">ESRAP</a><p><h3>Features:</h3>
<ul>
<li>Parses strings, vectors (e.g. binary data) and lists
</li>
<li>Allows parsing of nested sequences (e.g. trees, strings within lists, ...)
</li>
<li>Simple interface, very similar to Esrap
</li>
<li>Provides many specific and non-specific terminal symbols
</li>
<li>Implements the standard PEG (parsing expression grammar) expressions as well as useful extensions
</li>
<li>Packrat parsing can be enabled for individual PEG rules
</li>
<li>Parsing expression rules are compiled
</li>
<li>Parse tree transformations can be defined together with each PEG rule
</li>
<li>Grammars can be made context aware:
<ul>
<li>Run parse results of a PEG rule through lisp code to influence parsing success
</li>
<li>Share data between parse rules
</li>
</ul>
</li>
<li>Parsing rules can be parameterised
</li>
<li>Uses separate namespace(s) for parse rules
</li>
<li>Tracing of grammar rules
</li>
<li>Meaningful parse error messages
</li>
</ul><p><h3>Usage:</h3>
First, define a set of grammar rules:
<div class="code"><span class="nonparen"><span class="paren1">(<span class="nonparen"><i><span class="symbol">defrule</span></i> foo <span class="paren2">(<span class="nonparen"></span>)</span> <span class="string">"foo"</span></span>)</span>
<span class="paren1">(<span class="nonparen"><i><span class="symbol">defrule</span></i> bar <span class="paren2">(<span class="nonparen"></span>)</span> <span class="string">"bar"</span></span>)</span>
<span class="paren1">(<span class="nonparen"><i><span class="symbol">defrule</span></i> foobar <span class="paren2">(<span class="nonparen"></span>)</span> <span class="paren2">(<span class="nonparen"><a href="https://www.cliki.net/site/HyperSpec/Body/any_and.html" class="symbol">and</a> foo bar</span>)</span></span>)</span>
</span></div>
The rule <code>foobar</code> will parse the string <code>&quot;foobar&quot;</code>.<p>Parsing is initiated by calling
<div class="code"><span class="nonparen"><span class="paren1">(<span class="nonparen">parseq 'foobar <span class="string">"foobar"</span></span>)</span>
</span></div>
The result is the list <code>(&quot;foo&quot; &quot;bar&quot;)</code>.<p><h3>Homepage:</h3>
<a href="https://github.com/mrossini-ethz/parseq">https://github.com/mrossini-ethz/parseq</a><p><h3>Installation:</h3>
Parseq can be installed through <a href="Quicklisp.html" class="internal">Quicklisp</a>.<p><h3>License:</h3>
<a href="GPL.html" class="category">GPL</a></div></div>
<div id="footer" class="buttonbar"><ul><li><a href="parseq.html">Current version</a></li>
<li><a href="https://www.cliki.net/site/history?article=parseq">History</a></li>
<li><a href="https://www.cliki.net/site/backlinks?article=parseq">Backlinks</a></li><li><a href="https://www.cliki.net/site/edit-article?title=parseq&amp;from-revision=3748670698">Edit</a></li><li><a href="https://www.cliki.net/site/edit-article?create=t">Create</a></li></ul></div>
</div>
<div id="header-buttons" class="buttonbar">
<ul>
<li><a href="https://www.cliki.net/">Home</a></li>
<li><a href="https://www.cliki.net/site/recent-changes">Recent Changes</a></li>
<li><a href="CLiki.html">About</a></li>
<li><a href="Text&#32;Formatting.html">Text Formatting</a></li>
<li><a href="https://www.cliki.net/site/tools">Tools</a></li>
</ul>
<div id="search">
<form action="https://www.cliki.net/site/search">
<label for="search_query" class="hidden">Search CLiki</label>
<input type="text" name="query" id="search_query" value="" />
<input type="submit" value="search" />
</form>
</div>
</div>
<div id="pageheader">
<div id="header">
<span id="logo">CLiki</span>
<span id="slogan">the common lisp wiki</span>
<div id="login"><form method="post" action="https://www.cliki.net/site/login">
<label for="login_name" class="hidden">Account name</label>
<input type="text" name="name" id="login_name" class="login_input" />
<label for= "login_password" class="hidden">Password</label>
<input type="password" name="password" id="login_password" class="login_input" />
<input type="submit" name="login" value="login" id="login_submit" /><br />
<div id="register"><a href="https://www.cliki.net/site/register">register</a></div>
<input type="submit" name="reset-pw" value="reset password" id="reset_pw" />
</form>
</div>
</div>
</div>
</body></html>