diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-04-01 17:44:56 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-04-01 17:46:02 -0700 |
commit | d272501d9e10c61ed9e88f9e2f1bf9535e0b3cf1 (patch) | |
tree | c29fe98389c5b7e1055c2ce7590e11a0cae0e563 | |
parent | d6eb4717eee75cc5c40a0f59fec23d20f63d7a62 (diff) | |
download | cppawk-d272501d9e10c61ed9e88f9e2f1bf9535e0b3cf1.tar.gz cppawk-d272501d9e10c61ed9e88f9e2f1bf9535e0b3cf1.tar.bz2 cppawk-d272501d9e10c61ed9e88f9e2f1bf9535e0b3cf1.zip |
README.md: posit why cpp is so effective over awk.
-rw-r--r-- | README.md | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -47,7 +47,6 @@ preprocessor. One of them is a powerful `loop` facility that allows iteration (both parallel and nested) to be expressed by combining abstract clauses. - Here is a program designed to demonstrate the `cppawk` `loop` macro, with its multiple clauses. It solves the following problem: a projectile is fired vertically with an initial speed of 5. Every step of the @@ -86,6 +85,21 @@ The output is This example is taken from the [`testcases-iter`](../tree/testcases-iter) file. +By the way, how is it possible that we can implement an iteration language with +expressive, not to mention **user-definable** classes using a preprocessor that +is famous for lacking power? + +It turns out that a significant part of the problem with C preprocessing is the +back-end languages being targeted. The C and C++ languages rob their +preprocessing front-end of its full power. C macros in the context of the +"home language" have to contend with syntactic roadblocks, such as identifiers +having to be declared before use. Because Awk is a flexibly typed language in +which variables don't have to be declared, it creates opportunities for +significantly more freedom in how the C preprocessor can be applied, and the +resulting macros can be much more clutter-free and ergonomic compared to if +similar techniques were attempted on the "home turf". It's as if the C +preprocessor were tailor-made for Awk. + ## Roadmap `cppawk` is been carefully developed, and has a regression test suite. |