No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Сделаны задания 1, 3, 4


A simple recursive descent parser. Written for the formal languages course in HSE. The language is described with the following grammar:

T -> S | T ; S

S -> Expr | \epsilon

Expr -> Ident = Expr
      | Term ((+ | -) Expr)?

Term -> powTerm ((* | /) Term)?

powTerm -> nFactor (^ powTerm)?

nFactor -> Factor
        | - nFactor

Factor -> Ident 
        | Num 
        | '(' Expr ')'

Ident -> ('a'-'z')(('0'-'9')|('a'-'z'))*

Num -> ('0'-'9')+

Running the build script generates an executable Main. Main parses several inputs specified and terminates.

To run parser on your input, load Main into the interpreter ghci and execute parse <input> or modify Main.hs.

This should work on any version of the haskell compiler, but has only been tested on ghc 8.4.2.