Lerche: Generating data file processors in Julia from EBNF grammars

James Hester, Erez Shinan · The Journal of Open Source Software · 2021

In a scientific context, structured text is commonly encountered in data files and domainspecific languages (DSLs) for handling data.Extended Backhaus-Naur Format (EBNF) (ISO Central Secretary, 1996) is a well-established standard for describing the syntax of such structured text.A useful subset of such grammars is known as LALR(1), meaning that the grammars describe text that can be unambiguously parsed based only on the tokens already seen and the next token of input (DeRemer, 1969).LALR(1) stands out for being able to parse most programming languages, while guaranteeing O(n) run-time complexity and very light memory use.The Lerche Julia package automatically generates a parser that processes any data file or domain-specific language that can be described using a LALR(1) EBNF.The parse tree can be immediately transformed into application-specific data structures using usersupplied rules.This parser generator fills a gap in standards-based scientific work for the Julia ecosystem.Other native parser tools available for Julia projects include ParserCombinator (Cooke, 2021), Pegparser (Schneider, 2020), and the built-in Julia macro system.None of these

Read the paper · More papers on PaperTik