[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to decide what to put in the lexer and the grammar respectively?
From: |
Hans Åberg |
Subject: |
Re: How to decide what to put in the lexer and the grammar respectively? |
Date: |
Sun, 17 Feb 2019 18:19:00 +0100 |
> On 17 Feb 2019, at 17:36, Peng Yu <address@hidden> wrote:
>
> But how to recognize the nested parameter expansion assignment in the
> first place? The lexer should have builtin states to capture paired
> `{` `}`, and use states to remember whether it is in substring
> extraction or pattern replacement in order to make sure to capture any
> errors at the level of the lexer.
Such matched pairs can be recognized in the lexer by using an integer starting
at 0 adding 1 for each '{' and -1 for each '}' when valid. If one gets non-zero
at the end of the expression, there is a mismatch. The problem is how to
recognize the end of the expression. The Bison parser does that by a lookahead
token if needed. So that might suggest to put it on the parser.
- How to decide what to put in the lexer and the grammar respectively?, Peng Yu, 2019/02/17
- Re: How to decide what to put in the lexer and the grammar respectively?, Akim Demaille, 2019/02/17
- Re: How to decide what to put in the lexer and the grammar respectively?, Peng Yu, 2019/02/17
- Re: How to decide what to put in the lexer and the grammar respectively?, Akim Demaille, 2019/02/17
- Re: How to decide what to put in the lexer and the grammar respectively?, Peng Yu, 2019/02/17
- Re: How to decide what to put in the lexer and the grammar respectively?, Hans Åberg, 2019/02/17
- Re: How to decide what to put in the lexer and the grammar respectively?, Akim Demaille, 2019/02/18
- Re: How to decide what to put in the lexer and the grammar respectively?, Hans Åberg, 2019/02/18
- Re: How to decide what to put in the lexer and the grammar respectively?, Akim Demaille, 2019/02/18
- Re: How to decide what to put in the lexer and the grammar respectively?,
Hans Åberg <=
Re: How to decide what to put in the lexer and the grammar respectively?, Simon Richter, 2019/02/17