Skip to content

A functional HTML parser written with combinators.

Notifications You must be signed in to change notification settings

Ghaadyy/html-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A functional HTML parser written with combinators.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •