Hello. Tell me, please, a good book in Russian about how to write a compiler in C / C ++ languages. And also a book or a good article "how to write parsers of mathematical expressions". Thank you in advance.

Closed due to the fact that off-topic participants Oceinic , ermak0ff , Regent , redL1ne , aleksandr barakin 16 Oct '15 at 7:11 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • " Questionnaires are forbidden on Stack Overflow in Russian . To get an answer, rephrase your question so that it can be given an unambiguously correct answer." - ermak0ff, Regent, aleksandr barakin
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • And look for articles on Habré - AlexDenisov
  • I found there only on F #, and in programming I can still say NULL, and I don’t understand how to implement C / C ++ - Artie Lay
  • >> The book is about how to write compilers in C / C ++ and >> in programming, I can still say NULL Maybe you should start by learning algorithms (for example, pascal), then with a textbook on C / C ++, and then go to compilers ? - BOPOH
  • I don’t think I’ve already read Laforé OOP C ++ Rope long enough to shoot myself in the leg Lipman C ++ For beginners, I think I can handle it) - Artie Lay
  • @Artemiy_plus_plus, if briefly, but specifically, you are going to write in C ++, use recursive parsing of the compiled language (if, of course, the grammar of the language allows). Stacks of operations with their priorities and operands are well suited for parsing expressions with subsequent code generation or interpretation. Along the way, build a symbol table indicating the type of the operand. - avp

5 answers 5

Wisely experienced housewives use lex / yacc to write C parsers. There is a lot of literature on it, for example, O'Reilly .

To write a full-blown compiler, read Dragon Books . Do not complain that books are complex.

  • I'm not complaining, I understand that there is nothing simple) Thank you.) - Artie Lay
  • You are welcome! - VladD

Before reading books in the dragon book style, I would recommend reviewing a very entertaining introduction to compiler development - Jack Crenshaw. Let's create a compiler! .

Although they use the old Pascal dialect there, but this does not make the book worse. But basic things will teach to write. After reading and analyzing it, a simple scripting language or a compiler (although I would call a translator what happens, since you will most likely learn how to write a program that will translate code from your language into C or assembler) will not be so difficult.

  • I have a book by Creschnow D., but something I was afraid to read it, once on pascal. - Artie Lay

If we speak generally about the internal structure and development of languages, then programming languages: development and implementation of T. Pratt, M. Zelkovits is certainly worth reading.

I once read the first edition, but the modern (4th) with a bunch of new languages, unfortunately, is not on sale somehow.

Update

I just googled it and with the 3rd about the page I swung it (4th in Russian, however, djvu (in the transport on my devices you don’t read ...)).

  • Good) I add to the references) - Artie Lay

Here is another good book: Programming Languages ​​and Translation Methods

  • I can hardly understand, because there is C #, Java and Oberon, but thanks anyway, I'll try :) - Artie Lay
  • I don’t understand the description on this site from where, in the book, code examples mainly in Pascal should not be rewritten to C) The main principles to understand ... - anykey

Dragon book