So that the source code actually contains the text of its own compiler (parser)

The people do not understand. I will explain in more detail. Advise the ultra-high-level programming language (HQPPL), a program that could process and change its own code in COMPILE TIME

Let me give you a simple and contrived example to illustrate what the idea is.

For example, so that a language, for example, supports constructions like "if the call to the Tarl :: MySleep method (int, double) is present in the program code more than 3 times, then define the type MyType as a long double".

I repeat. The example is purely fictional and artificial, and serves purely to illustrate the idea.

In general, I need a PAU that would have the “iskoporeki”, which would allow to write programs that analyze and change their own code at the time of compilation (!!! Not at run-time). Those. so that the program is simultaneously a user extension of the compiler and the language.

Accordingly, it turns out that when you write a program in such a language, and change the TEXT of some part of it, the TEXT of other parts of the program may change when compiling with an automatic machine {that there is such a thing as a "preprocessor" I am aware of - but more serious and radical ones are needed BUILT-IN means language. Preprocessing tools (for example #IFDEF and macros with parameters in C ++) are not enough for me. It is necessary that the language include more advanced means of parsing and modifying its own source}.

Those. In the PAPSU, there must be operators whose operands are text objects in the source code itself.

Why did I call such a language a TOP-high language?

Well, because it is not the source code that is written on it, but the "source code source", so to speak.

Those. so that the source in the language is a mixture of compiler + application written in one language. And so that the source code "was dissolved" not the whole compiler, but only its extension for a given application.

If it’s completely simple, then you need a language that has a very powerful preprocessor, not limited to the banal IFDEF and parameter macros in almost all languages. So that the language was originally sharpened by the description of the source parsing in the source itself

Closed due to the fact that it is necessary to reformulate the question so that it is possible to give an objectively correct answer by the participants cheops , pavel , user194374, Bald , aleksandr barakin 1 Aug '16 at 7:17 .

The question gives rise to endless debates and discussions based not on knowledge, but on opinions. To get an answer, rephrase your question so that it can be given an unambiguously correct answer, or delete the question altogether. If the question can be reformulated according to the rules set out in the certificate , edit it .

1 answer 1

The TeX language, for example, is able to modify the source text during compilation (it thus, for example, collects cross-references). But at the same time, it does not “contain” its parser. It simply knows how to create (and recreate) files at compile time, and dynamically connect them.

  • Not. That does not suit me. I need the sparking language to support constructs that would allow describing, in fact, a part of the code of its compiler / parser directly in the source code. - Ismail Prokopenko
  • Preprocessing tools (for example #IFDEF and macros with parameters in C ++) are not enough for me. It is necessary that the language include more advanced means of parsing and modifying its own source - Ismail Prokopenko
  • @Ismail Prokopenko: I do not quite understand the meaning of the phrase "does not fit." An example fits your question , and the fact that it was not useful to you is probably the problem of formulating the question itself. We are not playing the game "guess what, I do not know what"? - VladD
  • one
    A language compiler is written in the language itself almost always, therefore, any language out of the box contains constructions that allow parsing and compiling the language. - VladD