On Saturday, 29 December 2018 09:13:15 UTC+8, Pablo Hugo Reda wrote:
> in 2005 I had the same idea, which was to replace, but something happened on the way, the macro language exceeds the c in flexibility,
>
> Leave the C and create my language derived from ColorForth.
Updates:
https://github.com/udexon/5CSM/blob/master/SMPG/README.md
Stack Machine Parser Generator
This example illustrate how Forth style colon definition can be used "rename" blocks of code of high level programming langauge (e.g. C/C++), thus making it more legible, structured and manageable.
The original post appeared on comp.lang.forth newsgroup.
The following is the output of cparse.php (will be uploaded after clean-up), a C parser written in PHP. It uses one simple rule: look for '{' and '}' as start and end markers, output block label as B_startline_startcol_endline_endcol. Each line starts with the line number, followed by the column number of either '{' or '}'. The number following IN_IF is the nest level of the block.
The input example is taken from
https://github.com/supernovaremnant/bazel-android-opencl/blob/master/opencl-info/opencl-info.cc
Even with such a simple example, it shows that the code can quickly grow intelligible, due to fundamental flaws in the design of high level programming languages.
The next step for cparser.php will be to provide the Forth style colon definition to "rename" the block labels B_* -- to give a legible name, to give it more meaning, structure and make in more manageable.