Menu

#809 A new parser, suitable for C23

None
open
nobody
None
5
2022-06-15
2022-05-13
No

During the past years, when adding new features, especially those of C23 I felt that the current parser might not be suitable to fully handle the whole range of C90 to C23. At first I thought we'd need separate parsers (C90-C17 vs C23), but now I think that a new parser that can handle them all should be possible.

I know of a project to create such a parser (AFAIK based on the Jutta Degener grammar from 2012, which is based on the Jeff Lee grammar from 1985). The license situation of that one is unclear though; if it gets resolved soon, we might be able to use parts of it.

This would also fix the function prototype issue [bugs:#2664].

Related

Bugs: #2664
Wiki: SDCC-STD-UX

Discussion

  • Philipp Klaus Krause

    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,4 @@
    -During the pas years, when adding new features, especially those of C23 I felt that the current parser might not be suitable to fully handle the whole range of C90 to C23. At first I thought we'd need separate parsers (C90-C17 vs C23), but now I think that a new parser that can handle them all should be possible.
    +During the past years, when adding new features, especially those of C23 I felt that the current parser might not be suitable to fully handle the whole range of C90 to C23. At first I thought we'd need separate parsers (C90-C17 vs C23), but now I think that a new parser that can handle them all should be possible.
    
     I know of a project to create such a parser (AFAIK based on the Jutta Degener grammar from 2012, which is based on the Jeff Lee grammar from 1985). The license situation of that one is unclear though; if it gets resolved soon, we might be able to use parts of it.
    
    • Group: -->
     
  • Konstantin Kim

    Konstantin Kim - 2022-05-16

    Hope it will be not single pass one.

     
    • Philipp Klaus Krause

      Why do you hope for it to not be single pass?

      It will most likely be a lex / yacc parser again.

       
      • Konstantin Kim

        Konstantin Kim - 2022-05-31

        A bit offtopic. I talk about compiler, not parser.
        https://sourceforge.net/p/sdcc/bugs/2962/#53ab

         
        • Philipp Klaus Krause

          Yes. Lexer and parser will be single pass anyway. In the long term, however we will want to do a the lexing and parsing pass, and then a second iCode pass. Not sure yet if the AST stuff should be part of the former or latter.

           
  • Philipp Klaus Krause

    Work has started. I think I'll do a new lexer first. For now I think, the old parser can mostly stay the way it is, while the work on the lexer is done. Maybe the new lexer can even be merged to trunk before the new parser is ready.

     
    • Philipp Klaus Krause

      In [r13508] I merged the current work into trunk. So far this is just an improved lexer, which fixes a few bugs, and improves error messages when encountering unsupported features, such as complex numbers and decimal floating point.

       

      Related

      Commit: [r13508]


Log in to post a comment.

MongoDB Logo MongoDB