|magic/absurd bash interpreter/compiler ? Avoid9Pdf@gmail.com (2012-12-23)|
|Re: magic/absurd bash interpreter/compiler ? miller@yoyo.ORG (J G Miller) (2012-12-24)|
|Re: magic/absurd bash interpreter/compiler ? email@example.com (Jonathan Thornburg) (2012-12-24)|
|Re: magic/absurd bash interpreter/compiler ? firstname.lastname@example.org (Eric) (2012-12-24)|
|Re: magic/absurd bash interpreter/compiler ? email@example.com (Barry Margolin) (2012-12-24)|
|Re: magic/absurd bash interpreter/compiler ? firstname.lastname@example.org (glen herrmannsfeldt) (2012-12-25)|
|Re: magic/absurd bash interpreter/compiler ? email@example.com (Eric) (2012-12-26)|
|Re: magic/absurd bash interpreter/compiler ? firstname.lastname@example.org (glen herrmannsfeldt) (2012-12-28)|
|Re: magic/absurd bash interpreter/compiler ? email@example.com (Barry Margolin) (2012-12-28)|
|From:||glen herrmannsfeldt <firstname.lastname@example.org>|
|Date:||Tue, 25 Dec 2012 03:25:01 +0000 (UTC)|
|Organization:||Aioe.org NNTP Server|
|Posted-Date:||25 Dec 2012 18:16:49 EST|
In comp.compilers Eric <email@example.com> wrote:
> Why on earth would you expect all computer languages to parse with a
> single pass from left to right? Neither Pascal nor Forth is a typical
> computer language. Pascal has more-or-less the sort of parser you seem
> to think should be universal, Forth does not! Bash (like other shells)
> is an interactive command-line based user interface which can also be
> used to write scripts, and it has evolved over many years, so why would
> it be like that?
(snip, our moderator wrote)
> [I've had a lot of questions from people who seem unclear on the
> difference between an interpreter and a compiler, and get confused as
> soon as the language gets complex enough that it can't be handled a
> line at a time by read-parse-interpret. Most languages I know can indeed
> be parsed in a single left to right pass, but all you have at that point
> is a parse tree, with a lot of the compiler's work left to do. -John]
There are many interpreted languages that pretty much can't be
compiled, at least in the usual sense of compilation. Especially in
shell languages, but also ones like TeX and Mathematica, where you can
expand variables to be keywords that are then parsed.
I once wrote self-modifying code in Mathematica. Someone wanted, in
the and, a Mathematica notebook with all the results and graphs, but
not with the Mathematica code. I wrote the code that asks the front
end to delete the code from the notebook. (Be sure to save before
testing during debugging.)
TeX has \expandafter which allows for run-time generation of names of
macros to execute.
One problem with many unix shells is that redirection is done too early.
Specifically, before an if test is done.
Return to the
Search the comp.compilers archives again.