Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #804
| From | glen herrmannsfeldt <gah@ugcs.caltech.edu> |
|---|---|
| Newsgroups | comp.compilers, comp.unix.shell, comp.os.linux.misc |
| Subject | Re: magic/absurd bash interpreter/compiler ? |
| Date | 2012-12-25 03:25 +0000 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <12-12-020@comp.compilers> (permalink) |
| References | <12-12-014@comp.compilers> <12-12-018@comp.compilers> |
Cross-posted to 3 groups.
In comp.compilers Eric <eric@deptj.eu> wrote: (snip) > 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. -- glen
Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
magic/absurd bash interpreter/compiler ? Avoid9Pdf@gmail.com - 2012-12-23 11:04 +0000
Re: magic/absurd bash interpreter/compiler ? J G Miller <miller@yoyo.ORG> - 2012-12-24 00:28 +0000
Re: magic/absurd bash interpreter/compiler ? "Jonathan Thornburg" <jthorn@astro.indiana.edu> - 2012-12-24 03:57 +0000
Re: magic/absurd bash interpreter/compiler ? Eric <eric@deptj.eu> - 2012-12-24 19:13 +0000
Re: magic/absurd bash interpreter/compiler ? Barry Margolin <barmar@alum.mit.edu> - 2012-12-24 20:48 -0500
Re: magic/absurd bash interpreter/compiler ? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-12-25 03:25 +0000
Re: magic/absurd bash interpreter/compiler ? Eric <eric@deptj.eu> - 2012-12-26 12:51 +0000
Re: magic/absurd bash interpreter/compiler ? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-12-28 03:17 +0000
Re: magic/absurd bash interpreter/compiler ? Barry Margolin <barmar@alum.mit.edu> - 2012-12-28 10:25 -0500
csiph-web