Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can ANTLR4 parser generator generate C code?

Tags:

c

antlr

antlr4

I'm studying antlr4 and, in the documentation, I read that the main targets of this parser generator are: Java, C#, Python2|3, JavaScript, Go, C++, Swift. Instead, the previous version (antlr3) includes also C.

My question is: is there a way to generate C code also in antlr4? Thank you

like image 607
Valerio Coretti Avatar asked Oct 14 '25 11:10

Valerio Coretti


2 Answers

Short answer: no, there is no C target.

For what it's worth, these are the available targets:

  • Java
  • C#
  • Python 3
  • JavaScript
  • TypeScript
  • Go
  • C++
  • Swift
  • PHP
  • Dart

Reference: https://github.com/antlr/antlr4/blob/master/doc/targets.md

like image 155
Bart Kiers Avatar answered Oct 17 '25 01:10

Bart Kiers


ANTLR4 parsing and code generation have been designed based-on object-oriented features such as inheritance and polymorphism, and so generating C target is a bit challenging because it not support object-oriented programming.

like image 31
Morteza Zakeri Avatar answered Oct 17 '25 01:10

Morteza Zakeri



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!