This since I don’t have a blog and I don’t know how to make a blog I will post my way of defining a grammar using EBNF and Regular Definitions in Gist form.
I have used my method with ChatGPT to generate Lex and Yacc files before. One language I have been implementing for about several months is AWK. I am now making an AWK to C translator (the more uninformed would call it a ‘transpiler’ but this term is NOT correct at all, it’s not very theoretical, transpilers are just [syntax-directed] translators). So anyways please read this document if you wanna learn about grammars, Chomsky type 2 and type 3, Lexical and Syntactic grammar, etc.
I also have a table that teaches you how to read EBNF. For the lazy, I will cite the table here:
Enclosed Right | Enclosed Left | Meaning |
---|---|---|
Single Quote | Single Quote | Single character |
Double Quote | Double Quote | Byte-sequence string |
Right Bracket | Left Bracket | What’s within is optional |
Right Curly | Left Curly | What’s within is repeatable |
Right Paren | Left Paren | What’s within is grouped |
Thanks.
You must log in or # to comment.