Writing Grammars: Mixing Regular Definitions with EBNF
gist.github.com
external-link
Writing Grammars: Mixing Regular Definitions with EBNF - README.md

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.

Create a post

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



  • 1 user online
  • 1 user / day
  • 1 user / week
  • 1 user / month
  • 1 user / 6 months
  • 1 subscriber
  • 1.21K Posts
  • 17.8K Comments
  • Modlog