Parser

From The Toaq Wiki
Revision as of 00:00, 15 March 2022 by Laqme (talk | contribs)

Toaq's grammar can be parsed by humans and computers alike. A piece of software that turns Toaq text into a syntax tree is called a parser.

Grammar formats

It's popular to write parsers in PEG format. In practice, PEG parser generators disagree on the specifics of the .peg format, meaning a PEG grammar tends to be tied to a specific implementation (say, PEGjs).

Hoemaı thinks PEG is not a good fit for Toaq. In fact, PEG can only describe context-free languages, which Toaq is not.[why?] Hoemaı wrote an early version of Toaq grammar in Prolog.

Parsers

Toaq-dev parser

The most actively developed parser lives here. It draws a syntax tree for some given Toaq Gamma text. This parser is a community fork of the official one written by Hoemaı for Toaq Beta.

You can provide input in Unicode or using ASCII tone markers.

The grammar is defined using PEGjs. The source code is here. The PEG grammar file is toaqlanguage.js.peg.

Mıu parser

Mıu is a tool by eaburns/Lỏq that parses Toaq Beta text and even turns it into logical notation. You can try it here.

The grammar (.peg file here) is defined in an extension of PEG, called peggy, developed by its author.