Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a parser in erlang [closed]

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.

like image 233
Chihab Adam Avatar asked Jan 05 '16 18:01

Chihab Adam


1 Answers

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.

like image 100
Hamidreza Soleimani Avatar answered Sep 17 '22 18:09

Hamidreza Soleimani