- Y
- Y is a stack-oriented FORTH-type programming language derived from Wouter van Oortmerssen's "FALSE".
Like FALSE, Y is cryptic to the extreme. (But it is much more powerful. Virtually all of the example programs in "Kernighan & Ritchie - Programming in C" can be done in Y in a fraction of time and code. :-) )
This stuff is provided as-is, I won't take any responsibility for damaged software, hardware, or brains. Since I'm still developing (well, something like that...), this is a very early beta version. Y looks stable and the small Y programs I tested worked fine, but this doesn't have to mean anything.
Y is what you get when you cross a programmable pocket calculator with a programming language like C. For some, Y is merely a toy. (But a very powerful one.) For others, it's just another cryptic unixlike command which probably can save you much time in special situations.
There are many good programming languages for doing large projects, but what do you use if you want a quick solution for those small but nasty everyday's problems which can't be managed with common commands? One day, I had recieved an ascii data file which must have gone through some noise-producing 7/8-Bit-gate. About twenty per cent of the characters had their highest bit set, so the text was totally corrupted. With Y, it took me less than twenty keystrokes to solve the problem by writing a binary filter. Here it is:(^$1_=~#127&,)%
After all rules have been added, Yeti dumps code for a [incr Tcl] class that implements the parser. This parser uses a deterministic state machine computed from the rules. This has the advantage of using only linear runtime and memory for parsing, but the disadvantage that it is not possible to update the parser after parsing has started. It is common usage to generate a parser once at package installation time, and to store the parser in a file, from where it is then sourced.
Parsers need a scanner to their job. The purpose of a scanner is to read tokens (terminals) from an input source. A scanner generator called Ylex is included in the Yeti package; after adding rules, it also dumps code for a scanner class.
Yeti is written in Tcl. It requires Tcl 8.x, [incr Tcl] 3.x. The parser generator also requires the struct module from tcllib; this module is not needed to run generated scanners and parsers.
No comments:
Post a Comment