more tpsh: control flow stuff

I’ve been trying to find a way of hooking in proper shell control flow keywords into tpsh, without uglifing the existing code. At the moment, tpsh understands executing singular command sequences, scripts, and a queue of command sequences. It’s fairly easy to modify the parsing/lexing portions to adjust the internal data structures IAW control flow keywords, the problem is how to handle execution phase.

Originally, I had in mind setting up nested data structures and doing a delayed execution: evaluate the control flow statement and modify the data, then execute the remaining commands (e.g. if CMD0; then CMD1; else CMD2; fi, would execute CMD when the statement needs to be evaluated at execution phase, then reshape the strucure so that only CMD1 or CMD2 remains, and then feed that back into the executor).

Last night, I had an interesting idea… on the case specific code generation.

Shell control flow basically amounts to very simple if, while, for, and case statements; and the more modern until and select statements. Normal execution patterns amount to using a single command sequence (e.g. cat f0 f1 f2 f3 | sort > f), or a queue of such command sequences. Why not replace that executor with a section of code, that understands how to handle those as well as control flow (etc), and then generate the desired code to execute the result.

Exempli gratia:

tpsh_cgen( ( [ 'if', 'test command' ],
[ 'then', 'other commands' ],
....
[ 'else', 'other other commands' ],
....
[ 'fi' ] )
)

might return something like:

sub { 
if (evaluate the 'test command' and test the exit status)
{
execute the 'other commands'
}
else {
execute the 'other other commands'
}
}

and so on and so forth; so that if we call the generated code ref, we have a set of code that will execute the correct commands, whatever they may be, and with quite a lot less fuss.

One way to tell I’m miserable, is when I stop coding…

I’ve effectively, not written a line of code since the third week of April or so… feeling a bit better now though, and the ideas have been cooking for the last 3 days… hehehehe 😀

Something I would do just for fun ;)

Build a modernized Galaga like game, that is simple, fun, highly addictive, and could be played for countless hours until you forget what day of the week it is — without needing quarters xD. Most definitely one made for a fast pace and long-haul style of play, like old arcade games, hehe.

It would also be a fun way to learn a few libraries ^_^.

My poor meatball

Todays lunch is leftover meatballs, potatos, and a smothering of gravy, as the old timers call it.

One of the meatballs went flying, if the laws of physics were different, it would’ve rolled out the door with the dog in hot pursuit looool.

Sometimes I hate dreams

I dreamt that we were hold up in a house, there was about 4 XL-sized automatics on a table with a bushel of magazines, and a head on the wall…

Like anyone stuck in an RE like nightmare, take two, load up, and try and secure a parameter; bad idea. After a bit of a zombie filled encounter, it’s down to the last room… Stick my head in, looks clear; but 4 corner hole problem: move in and risk getting ambushed from 1-3 sides. Handed my brother one of the autos and told him to cover the remaining sectors. Spider sense tingling, but area secured without ambush… good. On the way back to the front of the building, we were ambushed by a strange ‘fusion’ of a Model 101, T-1001, and a Vampire like Zombie; put the thing down with a few mags of ammo. Then a 2nd one showed up, having expanded everything on the first, it was necessary to retreat and take the other set of automatics; ejecting the mags, dropping them on the table, “Slap in a fresh mag, and pull the slide back”, taking the other automatics and moving to head off the mutated terminator…. several retreats for reload and shouting “LOAD”, and no help what so ever lol.

Somehow this reminds me of a strange dream some years ago, about Aliens taking over a school; and ending up in a knife fight with an Alien Queen trying to break down the door; no help from anyone lol.

Somehow I wonder, if ever up a creek without a paddle, would anyone lift a darn finger to help?

bored…

src: http://www.heuse.com/cphumor.htm

Interviewer: “Is studying computer science the best way to prepare to be a programmer?”

Bill Gates: “No, the best way to prepare is to write programs, and to study great
programs that other people have written. In my case, I went to
the garbage cans at the Computer Science Center and I fished
out listings of their operating system.”

There are 10 types of people in this world.
Those who understand binary, and those who don’t.

DEBUGGING : Removing the needles from the haystack.

Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
– Random Shack Data Processing Dictionary

“It is practically impossible to teach good programming style to students that have had prior exposure
to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.”
-Dijkstra

“The three most dangerous things in the world are a programmer with a
soldering iron, a hardware type with a program patch and a user with an idea.”
– _The Wizardry Compiled_ by Rick Cook

“The primary purpose of the DATA statement is to give names to constants; instead of
referring to pi as 3.141592653589793 at every appearance, the variable PI can be given
that value with a DATA statement and used instead of the longer form of the constant.
This also simplifies modifying the program, should the value of pi change.”
– FORTRAN manual for Xerox computers

“C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg.”
– Bjarne Stroustrup

“Programming graphics in X is like finding sqrt(pi) using Roman numerals.”
– Henry Spencer

“Never put off until run time what you can do at compile time.”
– David Gries, in “Compiler Construction for Digital Computers”, circa 1969.

BASIC programmers never die, they GOSUB and don’t RETURN.

Real programmers are surprised when the odometers in their cars don’t turn from 99,999 to 99,99A.

FORTRAN is not a language. It’s a way of turning a multi-million
dollar mainframe into a $50 programmable scientific calculator.

C is almost a real language. Even the name sounds like it’s gone through
an optimizing compiler. Get rid of all of those stupid brackets and we’ll talk.

Any sufficiently advanced bug is indistinguishable from a feature.

Programming is 10% science, 25% ingenuity and 65% getting the ingenuity to work with the science.

Science is to computer science as hydrodynamics is to plumbing.

We don’t really understand it, so we’ll give it to the programmers.

COBOL programmers understand why women hate periods.

Computer interfaces and user interfaces are as different as night and 1.

The human mind ordinarily operates at only ten 10% of its
capacity, the rest is overhead for the operating system.

A computer scientist is someone who fixes things that aren’t broken.

The computer is mightier than the pen, the sword, and usually the programmer.

Programming is an art form that fights back.

After a number of decimal places, who cares?

“Virtual” means never knowing where your next byte is coming from.

If at first you don’t succeed, you must be a programmer.

“It’s 5:50 a.m., Do you know where your stack pointer is?”

If God had intended humans to program, we would be born with serial I/O ports.

There are two ways to write error-free programs; only the third one works.

You never finish a program, you just stop working on it.

Deliver yesterday, code today, think tomorrow.

PL/1, “the fatal disease”, belongs more to the problem set than to the solution set.

Yea, though I walk through the valley of the shadow of APL, I shall fear
no evil, for I can string six primitive monadic and dyadic operators together.

Programming is a lot like sex. One mistake and you could have to support it the rest of your life.

Another Glitch in the Call
(Sung to the tune of a Pink Floyd song)

We don’t need no indirection
We don’t need no flow control
No data typing or declarations
Did you leave the lists alone?

Hey! Hacker! Leave those lists alone!

Chorus:
All in all, it was, just a pure-LISP function call.
All in all, it was, just a pure-LISP function call.

You can’t make a program without broken egos.

What I really need is aerobic exercise, and a way to [re]build [lost] endurance but that is kind of a major problem lol. If I actually had something to work with in terms of raw materials, I could at least build a primitive exercise bike or a treadmill, or something… I used to love running.

As good as no space, virtually no money (that reminds me, family hasn’t paid back most of my life savings yet!!!!), and essentially no freedom to go anywhere, or do anything outside the rats nest of a home, without ‘business’ to attend too. So, basically I am totally screwed anyway you slice it. Light strength training is about the only option, and even doing that here is like pulling teeth. I have enough physical strength to do most things I’ve ever had to do; only failure I ever had was trying to move a UPS, that likely weighed more then I did at the time lol.

It feels like living in a freaking prison, but one with decent food… and not much else.

Rats and Bats

my room: ~112 square feet on a wall to wall basis, but effectively 100 square feet due to the design cutting down on the *habitable* volume of the room

my free space: 4 square feet of open carpet

I.e. my room is basically a square, but when you take in to account what passes as furniture and all of the crap I’m stuck living with; that gives me a 4 1/2 by 6 1/2 foot area, whenever I am not sitting on the bed.

Last night I was watching a movie called Carbine Williams, about the genius; after looking at the scenes of the “hole” he was thrown in, really made me glad that I at least get to stretch my legs. Unfortunately, my life at home is just as good as dead, for all practical intentions…

oy.

Writer’s Block: How’d You Get Here?

There are many roads to LiveJournal—how did you first hear about LJ?

Live Journals Writer’s Block

Although I am sure the page has changed a lot since August/September 2006, my first knowledge of Live Journal likely came through Wikipedia’s “Blog” page. I spent at least a month or so researching blogging, in order to see how it might be useful for replacing my hodge-podge of log files and scripts. Wikipedia and a bit of Googling The Fine Web allowed researching various blogging sites.

I rarely stick my neck out into something without first doing reconnaissance in depth. I guess when it comes to things I perceive as a big deal: I have inherited more of my parents collective meticulousness then dads spontaneity.

After completing recon and general thinkin’ and plannin’ operations, Live Journal appeared to be the most favorable site at the time; never have regretted the choice either. Much to my joy, Live Journal has managed to kill off the incalculable log files on various hard drives.

Memory: Day one, followed by the inevitable first task ten minutes later. Him, that was around the time I was struggling to apply C in my after-hours time. Wasn’t very smart at the time, just persistent lol.