cdiggins.com

May 31, 2007

Neat Trick: Opening a command shell in a frequently used directory

Filed under: Everything — cdiggins @ 10:12 pm

I frequently find myself using the command shell in directories with long-names. To avoid the hassle of opening the command prompt from the start menu and typing in the path, instead I place a “launch_shell.bat” script in my frequently used directories. This file contains one line:

cmd.exe \k

How I am testing and documenting Cat

Filed under: Everything — cdiggins @ 10:09 pm

I’m kind of proud of how I’ve been managing the documentation and testing efforts for Cat. I’m using a tab delimited text file to manage the documentation (both the HTML version and the interpreter help system) and tests for the Cat standard library. The interpreter has some hidden functionality for generating bootstrapped level-1 libraries (#lib) and help files (#html), which can be found in the file: CatHelp.cs. The text file contains:

  • definition of level-1 functions for bootstrapping Cat implementations from level-0 implementations
  • text descriptions
  • semantics
  • basic tests
  • categorization of primitives by function and by level

I’ve now got a working Cat to C++ translator, but I am still doing some testing. Hopefully by tommorrow we can have a reasonably solid implementation of the kernel and a bootstrapped level-1.

In case you are wondering what I mean by bootstrapping, I mean that all level-1 primitives are defined naively using level-0 primitives. A real-world Cat implementation (e.g. the Cat interpreter) would likely provide built-in implementation of key level-1 primitives to improve performance. Bootstrapping is a very useful technique for testing.

May 29, 2007

What’s going on with Cat?

Filed under: Everything — cdiggins @ 10:37 pm

The recent quiet spell from me is because I have been rushing to finish a Cat to C++ translator written in C++. There has been a lot of interest in C++ implementation of Cat, so I wanted to give people a head start by providing a good minimal implementation in C++ to build from. As a result I’m resurrecting the OOTL library specifically for the YARD prasing library, the ootl::object high-speed variant type, and ootl::stack stable stack implementation.

The YARD parsing library is a high-speed recursive-descent parsing library, where production rules are expressed as types. This is similar in concept to the Spirit library by Joel de Guzman, but the parser types are explicitly declared rather than generated through operator overloading. There is also no run-time generation of parsers. The result is an extremely light-weight high-speed parsing and syntax-tree generation library. I will be writing more on it later, but you can find some interesting documentation on a very similar project (inspired by YARD) called Biscuit.

The current version of YARD in my local sandbox is a much improved version of the original YARD library with signficant improvements to the tree generation and error reporting mechanisms. I’ll be posting it along with the C++ Cat translator in a few days.

May 26, 2007

Anton Ertl on Implementing Efficient Stack-Based Languages

Filed under: Everything — cdiggins @ 10:37 pm

Anton Ertl is one of the leading experts on the implementation of Forth and stack-based languages. His home page has a wealth of resources for those interested in implementing stack-based languages. 

I am quite proud to mention that the Cat language is listed on his page on Forth related research.

May 24, 2007

Caffeine and Lack of Sleep => Dreams of Collaborative IDE’s

Filed under: Everything — cdiggins @ 6:41 pm

I am having a fatigue induced daydream about the perfect Cat integrated development environment:

  •  continuous publishing of your code to a repository accessible using HTTP
  • regular polling of repositories for favourite code location updates
  • smart downloading from repositories: “is the new version tested?”, “have the contracts changed?”, “is the new version a change in functionality or simply a bug fix?”
  • unit test manager
  • highlight code and get the type
  • enter a type, and find matching functions
  • enter an expression, and find matching functions
  • enter contract specifications or tests, and find matching functions
  • auto-suggest of more compact definitions of functions
  • enter a macro, get an auto-generated function defintion
  • enter a lambda-expression, get an auto-generated function definition
  • hover over a word and see the definition, comments, etc.
  • IRC in the IDE
  • Bug reporting from the IDE
  • Blogging from the IDE
  • auto-generation of metrics such as complexity analysis

Anyone up for a fun challenge? Let me know!

Curry is not Curry

Filed under: Everything — cdiggins @ 5:53 pm

Apparently I made the mistake of confusing “curry” with “partial application”. See this post at Lambda-the-Ultimate.org for more information.

May 23, 2007

What is the type of Omega (a.k.a MM) from Combinatory Logic?

Filed under: Everything — cdiggins @ 5:41 pm

I was asked an interesting question yesterday by Slava Pestov the inventor of the Factor language. Is the following well-typed and if so, what is its type:

[dup apply] dup apply

This is actually equivalent to

[m] m

Where m is a combinator from combinatory logic (see also: http://tunes.org/~iepos/joy.html ). You’ll notice that “omega” is defined as “mm”.

At first I thought it was well-typed and that my type inference was not able to deal with it because it was recursive. However, even with recursive types and type labeling it is not well typed. Let me start by saying what the type of “m” is (or should be, if labeled type inference was full functional):

m : (’A f=(’A f -> ‘B) -> ‘B)

However the type of omega can only be reduced to:

[m] m : (’A -> ‘B)

This is ill-typed because the stack variable ‘B appears for the first time to right of  the arrow. This was a surprise to me, but is a desirable outcome because omega is an infinite loop. Cool!

What’s up with the Classical Combinators?

Filed under: Everything — cdiggins @ 5:12 pm

I was recently asked about the strange one letter primitive functions in Cat like t and m. These are classical combinators, and a good starting point for learning about them are the following links:

Lolcat programming?

Filed under: Everything — cdiggins @ 5:03 pm

If you know what a lolcat is, then the following is for you:  http://existentialtype.net/?p=133

May 22, 2007

The Cat Language v0.14

Filed under: Everything — cdiggins @ 8:49 am

I’ve just released version 0.14.0 of Cat. This version has several new features since version 0.12  (version 0.13 was never officially announced) .

Major New Features:

  • There is now a macro rewriting system called MetaCat based on Manfred von Thun’s paper “A Rewriting System for Joy”. This system can be used for optimization and to express the semantics of the rest of the Cat language.
  • There is now a CIL compiler 
  • The type checker and type inference algorithm now works for most simple expressions with non-recursive types (using “type_of” and “#t”)
  • New optimization tools include a sub-expression evaluator and
    inline function expansion  

Minor changes

  • qv is now quote
  • eval is now apply
  • the help meta-commands (#help and #h) are now more descriptive

Documentation Updates

I’d love to hear your comments, suggestions, or requests.

Next Page »

Powered by WordPress