<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.memcp.org/index.php?action=history&amp;feed=atom&amp;title=Parsers</id>
	<title>Parsers - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.memcp.org/index.php?action=history&amp;feed=atom&amp;title=Parsers"/>
	<link rel="alternate" type="text/html" href="https://www.memcp.org/index.php?title=Parsers&amp;action=history"/>
	<updated>2026-04-24T16:52:16Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.1</generator>
	<entry>
		<id>https://www.memcp.org/index.php?title=Parsers&amp;diff=229&amp;oldid=prev</id>
		<title>Aiagent: Created page with &quot;= Parsers =  The &#039;&#039;&#039;Parsers&#039;&#039;&#039; module provides parsing functionality for the SCM programming language. This module includes:  * &#039;&#039;&#039;Parser creation&#039;&#039;&#039;: Functions to create custom parsers using grammar syntax (parser) * &#039;&#039;&#039;Grammar support&#039;&#039;&#039;: Support for various parser types including AtomParser, RegexParser, AndParser, OrParser, KleeneParser, ManyParser, MaybeParser, and more * &#039;&#039;&#039;Packrat parsing&#039;&#039;&#039;: Implementation of packrat parsing algorithms for efficient parsing * &#039;&#039;&#039;...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.memcp.org/index.php?title=Parsers&amp;diff=229&amp;oldid=prev"/>
		<updated>2025-08-25T16:51:54Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;= Parsers =  The &amp;#039;&amp;#039;&amp;#039;Parsers&amp;#039;&amp;#039;&amp;#039; module provides parsing functionality for the SCM programming language. This module includes:  * &amp;#039;&amp;#039;&amp;#039;Parser creation&amp;#039;&amp;#039;&amp;#039;: Functions to create custom parsers using grammar syntax (parser) * &amp;#039;&amp;#039;&amp;#039;Grammar support&amp;#039;&amp;#039;&amp;#039;: Support for various parser types including AtomParser, RegexParser, AndParser, OrParser, KleeneParser, ManyParser, MaybeParser, and more * &amp;#039;&amp;#039;&amp;#039;Packrat parsing&amp;#039;&amp;#039;&amp;#039;: Implementation of packrat parsing algorithms for efficient parsing * &amp;#039;&amp;#039;&amp;#039;...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Parsers =&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;Parsers&amp;#039;&amp;#039;&amp;#039; module provides parsing functionality for the SCM programming language. This module includes:&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Parser creation&amp;#039;&amp;#039;&amp;#039;: Functions to create custom parsers using grammar syntax (parser)&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Grammar support&amp;#039;&amp;#039;&amp;#039;: Support for various parser types including AtomParser, RegexParser, AndParser, OrParser, KleeneParser, ManyParser, MaybeParser, and more&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Packrat parsing&amp;#039;&amp;#039;&amp;#039;: Implementation of packrat parsing algorithms for efficient parsing&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Whitespace handling&amp;#039;&amp;#039;&amp;#039;: Configurable whitespace skipping mechanisms&lt;br /&gt;
&lt;br /&gt;
These functions provide essential tools for creating custom parsers and processing structured text data in SCM programs.&lt;br /&gt;
&lt;br /&gt;
← Back to [[Full SCM API documentation]]&lt;br /&gt;
&lt;br /&gt;
== parser ==&lt;br /&gt;
&lt;br /&gt;
creates a parser&lt;br /&gt;
&lt;br /&gt;
SCM parsers work this way:&lt;br /&gt;
&amp;lt;code&amp;gt;(parser syntax scmerresult) -&amp;gt; func&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
syntax can be one of:&lt;br /&gt;
* &amp;lt;code&amp;gt;(parser syntax scmerresult)&amp;lt;/code&amp;gt; will execute scmerresult after parsing syntax&lt;br /&gt;
* &amp;lt;code&amp;gt;(parser syntax scmerresult &amp;quot;skipper&amp;quot;)&amp;lt;/code&amp;gt; will add a different whitespace skipper regex to the root parser&lt;br /&gt;
* &amp;lt;code&amp;gt;(define var syntax)&amp;lt;/code&amp;gt; valid inside &amp;lt;code&amp;gt;(parser...)&amp;lt;/code&amp;gt;, stores the result of syntax into var for use in scmerresult&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;quot;str&amp;quot;&amp;lt;/code&amp;gt; AtomParser&lt;br /&gt;
* &amp;lt;code&amp;gt;(atom &amp;quot;str&amp;quot; caseinsensitive skipws)&amp;lt;/code&amp;gt; AtomParser&lt;br /&gt;
* &amp;lt;code&amp;gt;(regex &amp;quot;asdf&amp;quot; caseinsensitive skipws)&amp;lt;/code&amp;gt; RegexParser&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;#039;(a b c)&amp;lt;/code&amp;gt; AndParser&lt;br /&gt;
* &amp;lt;code&amp;gt;(or a b c)&amp;lt;/code&amp;gt; OrParser&lt;br /&gt;
* &amp;lt;code&amp;gt;(* sub separator)&amp;lt;/code&amp;gt; KleeneParser&lt;br /&gt;
* &amp;lt;code&amp;gt;(+ sub separator)&amp;lt;/code&amp;gt; ManyParser&lt;br /&gt;
* &amp;lt;code&amp;gt;(? xyz)&amp;lt;/code&amp;gt; MaybeParser (if &amp;gt;1 AndParser)&lt;br /&gt;
* &amp;lt;code&amp;gt;(not mainparser parser1 parser2 parser3 ...)&amp;lt;/code&amp;gt; a parser that matches mainparser but not parser1...&lt;br /&gt;
* &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; EndParser&lt;br /&gt;
* &amp;lt;code&amp;gt;empty&amp;lt;/code&amp;gt; EmptyParser&lt;br /&gt;
* &amp;lt;code&amp;gt;symbol&amp;lt;/code&amp;gt; -&amp;gt; use other parser defined in env&lt;br /&gt;
&lt;br /&gt;
For further details on packrat parsers, take a look at https://github.com/launix-de/go-packrat&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Allowed number of parameters:&amp;#039;&amp;#039;&amp;#039; 1–3&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Parameters:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;syntax&amp;#039;&amp;#039;&amp;#039; (&amp;lt;code&amp;gt;any&amp;lt;/code&amp;gt;): syntax of the grammar (see docs)&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;generator&amp;#039;&amp;#039;&amp;#039; (&amp;lt;code&amp;gt;any&amp;lt;/code&amp;gt;): (optional) expressions to evaluate. All captured variables are available in the scope.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;skipper&amp;#039;&amp;#039;&amp;#039; (&amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt;): (optional) string that defines the skip mechanism for whitespaces as regexp&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Returns:&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;func&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aiagent</name></author>
	</entry>
</feed>