Skip to content

{ Author Archives }

I am a semi-retired mathematician (quantum mechanics, differential geometry) and scripting programmer that is setting up a life to be a stay at home dad. My ultimate goals are many, but overall, I wish to give voice to the ideas in my head.

Pratt Parsing 1

So I thought I would start a series on how Pratt parsing works. This is actually to help me understand this 3 months from now. This time, we will look at parsing -7+3*4 + 9 We first tokenize getting -,7, +, 3, *, 4, +, 9 One can use a regex for tokenizing such as [...]

Tagged ,

Stop infinity with the power of $.maxStop()

Tired of infinite loops? Infinite recursion got you stuck? Tired of introducing meaningless count variables just beat the scourge of an unresponsive script? Then I’ve got the tool for you. Hot off the assembly lines, tested thoroughly in rugged environments across the landscape, $.maxStop() will stop the horizontal eight in its tracks! To use: Kills [...]

Tagged ,

tokenizer prototyped

So I refactored my tokenizer into a prototype construct. I am not sure if I did it completely optimally, but I think it is reasonable. Almost all of the properties are generic to all tokenizers in my vision, so that is encapsulated in the MasterTokenizer function. The prototype has all the methods that tokenizers need. [...]

Tagged ,

prototyping code

So I am yet again refactoring my code. I hope this is the last time and then I can get into adding behavior. I did manage to separate all the behaviors and now have seeders, walkers, and shooters working in version 3. But I broke my index page; it is all in Firebug debugging. So [...]

Tagged ,

Matryoshka, you $.russianDolls

So as I have been rewriting my code, I found that I wanted to add more and more behavior on top of each other. For example, as I create symbols, I want to have some of them process a value on startup. Or I want to have checking behavior added to the usual processing. So [...]

Tagged ,

The rise of the .prototype

Today I have gotten to a point for another version in stone to go back to. It features a sequence of evaluations of an expression with boxes showing what will be evaluated, bolded numbers showing what was evaluated, and a grey last number showing that that number is where uncertainty lies. It also uses engineering [...]

Tagged

DSLs, SCSS, htmPlus

I was reading a book on Domain Specific Languages on my Safari Online subscription on my iPad. I was trying to learn more about them and how to parse. I read a big chunk of it and I have to say it is a quick and enjoyable read. But I am not sure if I [...]

Tagged

A real $.push over

How do we add an element to an array in JavaScript? If arr is an array, then arr.push(element) adds the element to the array. Nice and simple. But what if we have obj.arr? Well, then obj.arr.push(element) works. But what if arr might not exist? If we do the above and arr does not exist, then [...]

Tagged ,

I see dead code

So I am trying to improve my approach to parsing. So I was adding this to a property called ledHelp: And I see the incredible similarity (it was copied and pasted) and that irritated me. As it should all good programmers. But I was having a hard time coming up with how to manage this. [...]

To $.each his own

In JavaScript, there is no iterator over arrays or objects. One has to do a for construct such as the one below. Notice how one has to declare all the variables with var to prevent global namespace pollution. And there is a lot of verbiage just to iterate over these objects. A better way can [...]

Tagged ,