Kyle Lahnakoski

Just One More Layer of Indirection
(Trying to achieve stable orbit with sufficient architecture)

Archive for the ‘Languages’ Category

Are Ad Servers Bogging Down the Web?

Monday, November 30th, 2009

Slashdot brings up a point I complain about: Ad servers are slowing down the web.

I do not use web applications because they are slow. I do not know what people do to pass the time when they wait for each page to load. Using web mail, and adding an attachment makes you feel like you wasted precious time.

The web is mostly slow because of server latency. Especially “waiting for …” whatever ad server has been bogged down. I particularly dislike the sites that also use the slow Google Analytics servers.

PI

Thursday, October 29th, 2009

I have a small programming project, called YAY, which I work on occasionally.  The objective of YAY is to be a type-safe and easy to use parser-generator-and-compiler.  The parser-generator is the easy part.  The compiler portion is more difficult.  Specifically, I am adding namespace processing so that the parsers specified are able to generate general graphs, and not just trees.  In theory, YAY should be able to parse simple “languages” like XML and HTML, including URLs and XML namespaces, with no post-processing.

Programming languages, like Java, should require macro definitions to become full compilers. Unfortunately, macro definitions have not been added to YAY yet.

Today I have discovered π (PI), which is very much like YAY.  This is good news because I do not particularly enjoy building YAY, I only like using it.  If π (PI) can replace YAY, then I can have someone else do the hard work, while I play at a higher abstraction level.  π (PI) looks interesting because it seems to have avoided YAYs intermediate parse tree representation, and seems to go directly to macro (re)writing. 

But, I am suspicious whether it works. 

Now, I could be wrong, but YAY is complicated for a reason:  It must allow identical language constructs inside different contexts to mean different things.  For example

    A: for (Object o : MyList){

      for (Object p : MyOtherList){

        if (something) continue A;

      }//for

    }//for

In this case the continue A; refers to scope that is ‘far’ from itself, and the same sequence of bytes can also refer to a different exit point of another loop later in the program. I am also thinking that exception handing scope can be more complicated.

It is not obvious how π (PI) achieves this non-local syntax specification.

In any case, language specification is one of my favorite subjects.  I am compelled to review the π (PI) implementation despite it being in a pre-alpha state.

Page’s Law

Monday, June 1st, 2009

Finally, a name for what I am interested in defeating:  Page’s Law.  I advocate a proliferation of domain specific languages, and higher level languages to help the programmer become more productive.  Unfortunatly, these high-level laguages make less (compile-time) assumptions and run much slower.

I do not know what Google has planned, but my plan is to focus on optimizing the abstract high level set-operations, and optimize the common compiler and interpreter operations.  This is nothing new, just they have not been done in a single system, during runtime, before.

Awesome Weekend!

Sunday, May 17th, 2009

Last time I spent a weekend hacking was a few years ago, in a tent. Back then, I converted a diff algorithm from C to Java, and put a friendly diff/merge API on top of it. This weekend is even better, because it is almost three days of no interruption, and no time was wasted traveling to and from a tent.

And, serendipitously: Finding The Coding Zone: Your Perfect Trifecta?

This weekend I am working on the next version of YAY, a parser specification language. This next version will be able to generate general parse graphs, as opposed to parse trees. This is good for the declarative aspect of some languages.

General parse graphs are generated from parse trees using some namespace as a reference to connect nodes of that tree. Essentially, any node can be given a name, and that name can be used by other nodes to refer to it.

The namespace is not flat, but rather can be transformed by the nodes to reflect the varying contexts represented by the parse tree. As you can imagine “this” in one part of the tree refers to a very different object then “this” in another part of the tree. Namespace transformations are used to portray changes in scope

I must also mention that the namespaces are limited to the context of the source code. This means namespaces can not be used to refer to objects that exist only in the runtime. I hope that this will not be too limiting: Classes, methods, and properties are all realized in the source code, so can be “named”. Futhermore, with a little trickery, prototypical instances can also be named; by assuming they occupy some part of the original source code: eg “this”.

Each node has access to namespace of local nodes to help derive it’s own namespace. The geeky conclusion is that the namespace dependencies must go though a dependency analysis so all nodes are calculated in the correct order. Yay! Dependency analysis!

PLOT

Tuesday, March 31st, 2009

I read on LtU that PLOT is an apparently new language with syntax and macros. The existing documentation is a little too high level, but at least the intent of the language seems to go in the right direction.

For a long time now, I have been hoping someone would add typed macros to a syntactically rich language. This is better than Lisp macros which are simply list concatenation macros**; PLOT should be able to identify bugs in macro definitions at compile time. Good luck to Mr. Moon, may his language take over the world and crush that boring Ruby.

** Lisp macros technically concatenate lists of parsed tokens, but since Lisp’s syntax is so simple, the macro must be explicitly coded to identify syntactic types.

kyle@arcavia.com