This is EBNF grammar for ANSI C (C99) and it contains almost every rule. It may be missing stuff, please tell me if you notice something missing.

I am writing a C compiler, with my backend and hopefully my own frontend in OCaml. That is why I wrote this grammar. I also have written the AWK grammar, but it’s not uploaded anywhere. Tell me if you want it.

Thanks.

  • OmnipotentEntity@beehaw.org
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    Trigraphs are handled by the preprocessor, so if you’re not handling that, then that’s fine. Digraphs are handled by the tokenizer, however.

    • ChubakPDP11@programming.devOP
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      Cool, I am making a second version were things are cleaner, I will add digraphs, trigraphs and preprocessor directives to the gramamr as wel. Thanks.