tree exported from hnb

- Main Ieda: Languages are usually constrained in many differnt ways, which either hinders ease of use, or can make a language unsuitable for large domains of problems.

- Constraints are simply all the things that aren't allowed.

- Example: when you go to the store, how much money/credit you have puts constraints on what you can buy.

- Severly constrained languages

- ftp

- think of ftp as a language that you can't do much with
- it is a severly constrained language

- grep

- regular expressions

- bob
- . -> b.b
- * -> b.*b
- ^ -> ^b.*b
- [] -> b[oa]b
- [^] -> b[^ ]b

- greps uses

- weblogs

- grep 'Nov 24' /var/log/apache/access.log - everyone who looked at something on the 24th or the 25th
- grep index.html /var/log/apache/access.log - just hits to the homepage

- man pages

- man iptables | grep -i flush

- any time your searching for something, or want to filter something

- grep constraints

- no ability to loop
- cannot add new commands/charactors to the "regular expression" language

- sed

- Substitute Command

- sed 's/bob/xxx/' datafile
- sed 's/^/filename:/' datafile

- Delte Command

- sed '/bob/d' - delete anything with bob in it
- sed '/bob/d
- /e/d' - delete anything with "bob" or a e in it.

- Append

- sed '/bobbin/a\
- hatchet' datafile - add the word hatchet after the word bobbin

- Lots of other similar commands
- Test

- sed ':top
- ***programming loop***
- s/bob/bob/
- t top' datafile

- The test command makes a major differnce in the language. now looping can be done.

- Virtual machines

- atari emulator
- bochs is a 386 emulator that can emulate a 386 on any processor running linux.
- you can load linux under the bochs emulator & run your favoritie tools.
- Therefore any language that is capable of haveing a 386 emulator written in it, is capable of performing any computational function that can be done under linux, and any computational function that could be written for linux.
- We using the branch command we could attempt to write a 386 emulator with sed by storing our variables with the append command.
- sed has no fork command built into it. we could fix it by writing a virtual 386 and write a new sed for that 386.
- Summary

- Sed has less constraints then grep & ftp in that it can do any computational process, but is still constrained in what you are allwed to do with it.

- Order

- Commands directly written into sed would be first order.
- code chunks written in 386 machine code, that we execute in the virtual 386 that we write in sed will be called second order objects.
- if we write & load linux in C compiled to the 386, then the C lanuage chunks become third order objects. We can then write sed in linux, but this time we can add support for fork into sed. sed chucnks written executed by this version of sed would be our fourth order objects.
- We now know it's possible to write a fork command inside of sed, but for every extra layer that we add, we increase complexity & decrease efficency.
- We now know it's possible to write a fork command inside of sed, but for every extra layer that we add, we increase complexity & decrease efficency.
- Therefore we can try to minimize the number of layers. Ideally there would only be one layer, where all our objects were first order sed objects, and we could call fork from these first order sed objects. unfortunately sed provides no way for us to add a fork command to the first order language from inside sed. But we can write a "sed emulator" in sed, adding just a scheduler and a fork command to the second order language.
- In fact we can add any computation features we want to sed, in our second order system, and we can custom design the lanugage to make the task at hand as easy as possible to specity.

- C/C++

- demo1

- C can add commands to the standard language interface that accept parameters.
- abstracting common code into new procedures

- the cad program - demo2

- writing a new language for our particular purpose, by extending the original lanugage.
- we get to keep all the features of the original language

- OOP/C++

- ability to group variables into "objects"
- like records in a database
- our langauge continues to evolve.

- LISP

- standard version
- multiple inheritance

- color-mixin
- other uses

- Reflection
- MOP
- Summary

- Differnt languages have differnt constraints. These can make the language more dificult to use, or can make a language unusable for a particular class of problems. One should choose a language with as few constraints as possible to solve the problem at hand, then be *very careful* about what constraints you impose on the user, when you develop your new "sub-language" for them.
- note on hooks