6

How to create a parser in erlang that will take in a properly formed propositional formula and converts it into some internal representation.

Listing the available tools for creating a parser in erlang and also projects that uses them can be helpful.

Hamidreza Soleimani
  • 2,504
  • 16
  • 19
Chihab Adam
  • 99
  • 1
  • 6
  • To answer your question need to know the more details. –  Jan 05 '16 at 18:38
  • 2
    Look up the documentation for [leex](http://erlang.org/doc/man/leex.html) and [yecc](http://erlang.org/doc/man/yecc.html). – Steve Vinoski Jan 05 '16 at 18:40
  • Here's how to build your own parser for expressions, without any use of parser generator tools: http://stackoverflow.com/questions/2245962/is-there-an-alternative-for-flex-bison-that-is-usable-on-8-bit-embedded-systems/2336769#2336769 – Ira Baxter Jan 27 '16 at 03:22

1 Answers1

8

You can use leex, yecc, spell1 and some others.

  • leex: A regular expression based lexical analyzer generator for Erlang, similar to lex or flex. A lexer file includes parts for Definition, Rules and also Erlang codes.

  • yecc: An LALR-1 parser generator for Erlang, similar to yacc. A parser generator file includes parts for Non-terminals, Terminals, Rules and Root-symbols.

  • spell1: An LL(1) parser generator for Erlang and LFE which is a Lisp dialect language on top of Erlang.

  • neotoma: A packrat parser-generator for Erlang for Parsing Expression Grammars (PEGs).


Some open source projects that uses them:

  • Efene: Alternative syntax for the Erlang Programming Language focusing on simplicity, ease of use. It uses leex and yecc for parsing the language syntax of Efene.
  • ErlyDTL: Django templates for Erlang which uses leex and yecc to parse Django based template language.
  • Tnesia: A time-series database which has a SQL-like language (TQL) which implemented with leex and yecc.

This Slide includes some useful examples about how to use them.

Hamidreza Soleimani
  • 2,504
  • 16
  • 19