RSParser | Parser for RSS , Atom , JSON Feed , RSS-inJSON , OPML , and HTML
kandi X-RAY | RSParser Summary
kandi X-RAY | RSParser Summary
This framework was developed for NetNewsWire and is made available here for developers who just need the parsing code. It has no depencies that aren’t provided by the system. Update 6 Feb. 2018: RSParser is now a CocoaPod, with the much-appreciated help of Silver Fox. (We think it worked, anyway. Looked like it did.).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of RSParser
RSParser Key Features
RSParser Examples and Code Snippets
Community Discussions
Trending Discussions on RSParser
QUESTION
So I'm trying to do the standard "write yourself a parser for a scheme-like language" exercise to figure out MegaParsec and monad transformers. Following the suggestions of many tutorials and blog posts, I'm using ReaderT
and local
to implement lexical scope.
I run into trouble trying to implement let*
. Both let
and let*
share the same syntax, binding variables for use in a subsequent expression. The difference between the two is that let*
lets you use a binding in subsequent ones, whereas let
doesn't:
ANSWER
Answered 2018-Dec-21 at 10:50As Alexis King pointed out in comments, it is standard practice to separate parsing from evaluation.
However, to address the current question, it is possible here to evaluate while parsing in an idiomatic way. The key point is the following: lexical scoping without any context-sensitive rules only ever requires a Reader
monad, for scope/type checking and evaluation as well. The reason is in the "lexical" property: purely nested scopes have no side effects on other branches of scope structure, hence there should be nothing to be carried around in a state. So it's best to just get rid of the State
.
The interesting part is letStarExpr
. There, we cannot use many
anymore, because it doesn't allow us to handle the newly bound names on each key-value pair. Instead, we can write a custom version of many
which uses local
to bind a new name on each recursive step. In the code example I just inline this function using fix
.
Another note: lift
should not be commonly used with mtl
; the point of mtl
is to eliminate most lifts. The megaparsec
exports are already generalized over MonadParsec
. Below is a code example with megaparsec
7.0.4, I did the mentioned changes and a few further stylistic ones.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install RSParser
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page