Skip to content

Latest commit

 

History

History
35 lines (24 loc) · 1 KB

README.md

File metadata and controls

35 lines (24 loc) · 1 KB

Functional HTML Parser

Getting Started

To execute the demo project, run the following command.

ghc Main.hs -outputdir build -o build/main && ./build/main # executes the Main.hs

To run the tests, execute the following command. Make sure to have Hspec installed.

ghc Test.hs -outputdir build -o build/test && ./build/test # executes the Test.hs

Project Structure

  • Grammar.hs: contains the HTML grammar written with parser combinators
  • DOM.hs: contains the DOM ADT and functions that manipulate it
  • Combinators.hs: contains the implementation of parser combinators based on [1,2]

Core Features

  • HTML document parsing
  • Diff computation between two DOMTrees
  • Markdown compilation
  • DOM-like API, featuring findById, findByClass and others
  • Unit testing

References

  • [1] Daan Leijen and Erik Meijer. Parsec: Direct Style Monadic Parser Combinators For The Real World. 12 2001.
  • [2] Heitor Toledo Lassarote de Paula. Parser Combinators in Haskell. Online, 2021.