Answer the question
In order to leave comments, you need to log in
How to feed an existing compiler a new syntax?
Let's say there is a language c++ or c, there is a compiler for them. If you do not change anything in the structure of the language, but change its syntax, then how to make the compiler understand the new spelling? That is, instead for ( var i =1; i < 3; I ++)
of writing for i, 1, 3 do
What needs to be changed?
What books to read on this topic? Where to look?
Answer the question
In order to leave comments, you need to log in
syntax defines the structure of the language.
Specifically, here you suggest that the compiler independently deduce the type of the loop counter (quite realistic in the new standards), decide on its own what to do the comparison for less (in algorithms they often use != for iterators) and decide that the counter increase is an increment. Those. it's not a different syntax at all, it's a whole different thing.
Stubborn Olympiads love to make macros like:
#define FOR( A, B, C ) for( int A = B; B < C; ++A )
DO NOT DO THIS!!!
Where to look?
If you are not interested in this particular example, but in general, then there are 2 wonderful books: SICP and The Book of the Dragon.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question