LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

Use Monospaced Font
Show HTML Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Mime-Version:
1.0
Content-Type:
text/plain; charset="UTF-8"
Date:
Fri, 21 Feb 2020 08:02:44 +0100
Reply-To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Subject:
Content-Transfer-Encoding:
quoted-printable
Message-ID:
Sender:
Mailing list for the LaTeX3 project <[log in to unmask]>
From:
Kelly Smith <[log in to unmask]>
Parts/Attachments:
text/plain (57 lines)
On Wed, 19 Feb 2020 14:34:33 +0100, Kelly Smith <[log in to unmask]> wrote:

>On Wed, 19 Feb 2020 12:27:31 +0100, Bruno Le Floch <[log in to unmask]> wrote:
>
>>On 2/19/20 10:25 AM, Jonathan Spratte wrote:
>>> Hi,
>>>
>>>> - Defining an environment that sets up active characters to emulate
>>>>   traditional BNF syntax is very concise, but comes at the cost of
>>>>   delimited arguments and catcode madness.
>>>
>>> You could as well use a letter-by-letter parser that doesn't need altered
>>> category codes. Take a look at the pgf module `parser`. That's not `expl3`
>>> but could give you an idea on what's possible.
>>>
>>> Best,
>>> Jonathan
>>>
>>
>>I've been *toying* for a long time (haven't gone very far) with the idea
>>of writing a parser generator, but I couldn't decide how powerful to
>>make it.  One option would be to support "parsing expression grammars"
>>(PEGs), which can be parsed in linear time using a packrat parser (but
>>use a lot of memory, possibly problematic).  Another option would be to
>>stick with more traditional things like LL or LR parser.  To be honest,
>>I don't know enough about parsers and what useful languages they cover
>>to decide.  Thoughts welcome.
>>
>>Best,
>>Bruno
>
>Given that the machinery already exists in the regex module, I would
>suggest making a lexer generator and then complementing it with
>a parser generator.
>
>Some quick reading suggests that LALR parsers (e.g. YACC) would be
>a good balance of expressiveness and efficiency. Since this would be
>used for document syntax, the parsers do not need to be very powerful,
>since user-facing syntax should be relatively simple and certainly
>should be unambiguous.
>
>Warmly,
>Kelly

After discussing with a friend who’s more knowledgeable about parsers
than I, I’m retracting my suggestion of an LALR parser, in favor of PEGs.

However, after thinking about it, I’ve come to favor the idea that parsing
document syntax should still be done as it’s always been in LaTeX:
incrementally and interleaved with command execution. Trying to parse and
heavily process entire documents or even large sections at once would be
very resource-intensive and require a lot of tooling. I’ll have to consider this
further and see if I can explain it more fully.

Warmly,
Kelly

ATOM RSS1 RSS2