Our server costs ~$56 per month to run. Please consider donating or becoming a Patron to help keep the site running. Help us gain new members by following us on Twitter and liking our page on Facebook!
Current time: July 31, 2025, 9:49 am

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Complicated AST manipulation looks ugly in C++. How to refactor it?
#14
RE: Complicated AST manipulation looks ugly in C++. How to refactor it?
(January 27, 2022 at 5:29 pm)HappySkeptic Wrote:
(January 27, 2022 at 2:16 pm)Jehanne Wrote: Isn't that the whole point of a compiler, to translate computer code into machine code?  I would ditch the C++ and just use C, modeling your new language on an existing one.  C#, after all, "borrowed" heavily from Java.

Anyone writing complex code in C is crazy or a masochist.  C++ at least has the standard template library (even if it is a pain to learn).

Using C++ allows Flat to potentially compile his compiler into any platform, including webassembly.  Yes, that can be done with other languages, but it isn't easy with garbage-collected languages.

It's a matter of trade-offs. Hand-optimizing C is a lot more effective than trying to optimize object-based code. Time is money with compliers.
[Image: extraordinarywoo-sig.jpg]
Reply



Messages In This Thread
RE: Complicated AST manipulation looks ugly in C++. How to refactor it? - by Angrboda - January 27, 2022 at 5:58 pm



Users browsing this thread: 1 Guest(s)