I want to write a compiler for a custom markup language, I want to get optimal performance, and also want to have a nice scalable design.
A multi-paradigm of a programming language (C ++) is more suitable for implementing modern design patterns , but I think it will degrade performance a bit (like RTTI ), which more or less can make C a better choice.
Interestingly, this is the best language (C, C ++, or even Objective-C) if someone wants to create a modern compiler (in the sense of adhering to modern software engineering principles as software), which is fast, efficient and well designed.
The “expensive” C ++ functions (for example, exceptions, virtual functions, RTTI) simply don't exist in C. By the time you mimic them in C, you are likely to get something, at least as expensive as it is in C ++, but less known, less documented, etc. (let it look like this: the authors of the compilers are not stupid, but perhaps you can implement the function "better" than they are, this is not particularly likely).
In the other direction, templates (in one example) often make it relatively easy to write code that is much faster than practical in C. For just one obvious example, C ++ code using std::sortwill often be two to three with as fast as the equivalent C code using qsort.
std::sort
qsort
: , ++ , C, , ( - ) . - . , ++ - . , , - .
++ " , ". - . .
OCaml? . - , .
OCaml , C ++. , .
F # - , .NET.
, C , .
, lex yacc ( flex bison).
, , ++, Java - .
, , , C/++ - . , , ? ? ? 60 + , , , .
( + flex , ). C ++ . C, bison C, C, . , , ++, AST .
ML . , , ( , ). , , bison ( , C/++ bison).
. . C . , - , , (, , , , )
, , , , , C/++ ( ) .
/ , . , - : "OO - ", - : " , , ".
Source: https://habr.com/ru/post/1783986/More articles:Is this the correct use of HTML5? - html5Avoiding preemptive_oledbops SQL Server 2008 with linked servers - sql-server-2008-r2How can I update another model with a callback? - callbackPython: how to disable the keyword "property"? - pythonHow to start a new facebook web application - c #JQuery Star Rating plugin - selection in callback causes endless loop - javascriptShould I match the curly brace of the previous author? - standardsPHP: how do I know if a user is uploading a file? - phpPerl regular expression for English word - regexIs there a plugin or gem that can help me “invite a friend” on the rails? - emailAll Articles