You are here: Foswiki>WorldFoundry Web>PrepDesignGoals (06 Jan 2003, KevinSeghetti;)Edit Attach
prep was started before I (kts) was much of an internet user (way back in 1994), so I didn't know about m4. However, looking at m4 now I don't like it.

prep was written to get around limitations of the c preprocessor.

Some of my design goals: Only ONE escape character (@, choosen because C doesn't use it). I hate having to escape half of the characters because they mean something to the preprocessor.

Better macros: default parameters in macros (heavily used in the oas directory) (and, better than C++, the defaults don't have to go at the end, and you can specify param 1, default 2, param 3 (you just put two commas in a row)).

Ability to have preprocessor commands in macro expansions

Better expression handing.

regular expression based search/replace.

More powerfull macro execution: in prep you can define a macro during macro execution. This amounts to having variables "@define foo @e(foo+1)@t" will create a string which is numerically 1 larger than it was before (@e = evaulate expression, @t = terminate macro definition).

stream oriented instead of line oriented. With a few exceptions, all prep commands can operate in the middle of a line (or the middle of a macro invocation).

Written as a text input class. Prep can be used in any program to pre-process text (hand it a file to open, and call GetLine repeatedly to get processed text).

Small. The code base is small enough to understand in just a few hours (I think).

See Prep for syntax.

It has grown to have looping and other sick things God did not intend a text preprocessor to have.

I think prep is a pretty good pre-processor, unfortunatly what the oas directory needs is more of a real scripting language, there are constructs in the oas directory which are quite cryptic becuase I am using prep for more than a preprocessor should be used for.

shortcommings:

Cryptic. Not well documented (sometimes I read the source when writting prep macros).

Slow. Doesn't process text particularly fast (watch how long it takes to make in the oas directory).
Topic revision: r1 - 06 Jan 2003, KevinSeghetti;
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback