Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I learn about parser combinators? [closed]

Tags:

parsing

monads

I've found a few resources on the subject, but they all require a deep understanding of SmallTalk or Haskell, neither of which I know.

like image 935
James A. Rosen Avatar asked Aug 20 '08 12:08

James A. Rosen


People also ask

What is the use of parsing?

Parsing, syntax analysis, or syntactic analysis is the process of analyzing a string of symbols, either in natural language, computer languages or data structures, conforming to the rules of a formal grammar.

What is meant by parser?

A parser is a compiler or interpreter component that breaks data into smaller elements for easy translation into another language. A parser takes input in the form of a sequence of tokens, interactive commands, or program instructions and breaks them up into parts that can be used by other components in programming.

What is parser Haskell?

Parser combinators are known to be simple to use without requiring external tools or too many concepts to learn. That is, they are ordinary Haskell constructors that can easily be combined and returned with other parsers because of their nature as functions.

Are parser combinators slow?

Parser combinators are generally slower than a hand-written or code-generated parser. That's somewhat innate due to the overhead of “threading” (for lack of a better word) your control flow through many function calls.


2 Answers

I wrote 8 longish blog entries on monadic parser combinators in C# and F#; see here for the first one.

See also FParsec (Parsec for F#)

like image 145
Brian Avatar answered Oct 11 '22 09:10

Brian


Here are some parser combinator libraries in more mainstream languages:

  • Spirit (C++)
  • Jparsec (Java)
like image 43
Antti Kissaniemi Avatar answered Oct 11 '22 09:10

Antti Kissaniemi