The Artima Developer Community
Sponsored Link

Weblogs Forum
Cat Source Code at CodeProject.com

4 replies on 1 page. Most recent reply: Nov 29, 2006 7:58 AM by Cleo Saulnier

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 4 replies on 1 page
Christopher Diggins

Posts: 1215
Nickname: cdiggins
Registered: Feb, 2004

Cat Source Code at CodeProject.com (View in Weblogs)
Posted: Nov 4, 2006 4:38 PM
Reply to this message Reply
Summary
I've recently posted the Cat source code to CodeProject.com with a reasonably detailed description of the design and implementation.
Advertisement
Even though the Cat language has relatively simple syntax and semantics, the type system is not trivial. To help people who are interested in using or modifying the source code I decided to write an article which supplements the internal documentation, and could aid people in understanding the design and implementation of the interpreter. The article is available on CodeProject.com at http://www.codeproject.com/useritems/cat.asp

Cat is implemented in C# and the source code is public domain, which means it easily used in commercial or open-source projects, and is compatible with any kind of license you desire. To download the source code through CodeProject.com you have to register, but you can also download the source code from my site at http://www.cat-language.com/download.html.

The article should prove to be interesting for those of you interested in the implementation of interpreters and compilers. Also for those of you interested in using the Cat interpreter (or some variant of Cat) as a scripting add-on to an existing application. Cat of course is also interesting as a stand alone package, and could be used with wrapper applications. Some of the ideas I for projects I'd like to develop are:

  • A Cat with macros extension language
  • An EcmaScript style syntax wrapper around Cat
  • A Scheme to Cat translator
  • An implementation of Cat without types in C++, Scheme and F#/OCaml
  • A Cat to C translator

Cat is an extremely easy to implement language, if you disregard type inference. I would estimate that it shouldn't take more than one or two person weeks to implement in a modern language, assuming you leave out all type checking and type inference code and you use the pre-existing code as a model.

This means that Cat is also easy to port, translate to, and translate from. I expect over the next year to see various implementation of Cat pop up all over the place This is based on the interest expressed by various people over the internet.

Cat can also be easily used as a scripting language to extend applications. If you don't like the Cat postfix notation, it is a relatively easy task to implement a prefix notation front-end. In fact this one of the projects on my to-do list.

I'd love to hear whether the Cat source code comes in useful to you, or finds its way into any of your projects, or if you decide to extend Cat to make your pet language.


Cleo Saulnier

Posts: 77
Nickname: vorlath
Registered: Dec, 2005

Re: Cat Source Code at CodeProject.com Posted: Nov 23, 2006 10:56 AM
Reply to this message Reply
I'm going to take a look at it today. May I reserve the name 'Tiger' for the adapted version? I just want to check that I'm not using a name that you were keen on using.

BTW, I can't put it in public domain. Here in Canada, that only applies to expired Copyrights and government records. So I'll give an equivalent worldwide, perpetual license where everyone can do whatever they want with it. If I actually get something done (no promises), I'll leave your creds in it.

Christopher Diggins

Posts: 1215
Nickname: cdiggins
Registered: Feb, 2004

Re: Cat Source Code at CodeProject.com Posted: Nov 26, 2006 7:03 PM
Reply to this message Reply
> I'm going to take a look at it today. May I reserve the
> name 'Tiger' for the adapted version?

I have no objections but Andrew Appel already named a language Tiger in his series of books "Modern Compilation Implementation in {Java,ML,C}". There are other instances of the languages being called Tiger as well, so you might want to consider a new name.

A list of 2500 languages at http://people.ku.edu/~nkinners/LangList/Extras/langlist.htm might help you avoid name collisions ;-)

> I just want to
> check that I'm not using a name that you were keen on
> using.

I haven't made my mind up on anything yet. So no need to worry about me.

> BTW, I can't put it in public domain.

You don't have to. You can use public domain work in anyway you want. Your derived work can have any license. The only thing that you are prevented from doing is patenting my work.

> Here in Canada,
> that only applies to expired Copyrights and government
> records.

I'm Canadian as well, I just happen to live and work in the US for the time being.

I am quite confident that even in Canad nothing prevents an individual from releasing work into the public domain, if they so choose, but I am not an expert an IP law.

However, your license choice is entirely up to you.

> So I'll give an equivalent worldwide, perpetual
> license where everyone can do whatever they want with it.
> If I actually get something done (no promises), I'll
> l leave your creds in it.

That would be very generous. Realize though that you are under no obligations. Public domain work often surprises people in that it truly is a gift to the entire world with no strings attached. That said, I would love to get credit.

Vincent O'Sullivan

Posts: 724
Nickname: vincent
Registered: Nov, 2002

Re: Cat Source Code at CodeProject.com Posted: Nov 27, 2006 6:26 AM
Reply to this message Reply
> May I reserve the
> name 'Tiger' for the adapted version? I just want to
> check that I'm not using a name that you were keen on
> using.

"Tiger"? Wasn't that the pre-release name for Java 1.5?

Cleo Saulnier

Posts: 77
Nickname: vorlath
Registered: Dec, 2005

Re: Cat Source Code at CodeProject.com Posted: Nov 29, 2006 7:58 AM
Reply to this message Reply
I just thought Tiger related well to Cat and there was nothing on it on Google. Oh well, I'm sure there are other animals in the feline category.

I looked at the code and although I could convert most of the C# data structures to C++, I'm not sure I'm up to the task of converting your custom Enumeration classes. I don't know if implementing a class that does the same or subclassing a container class is the best way. Although I could port it as is, I'm not sure it would be clean C++ and I'm not sure how I would implement the features I want in such an environment. This would also take away time from my own project. So it'll have to wait for another day. I'll have to give it some thought before I commit to it. I have my own LR(1) parser generator and it seems to me this would be a lot easier to use with action routines. This way, I can follow along what it's doing in the grammar.

Christopher, what did you use for parsing? I didn't look too far into it, just the data structures. Do you have a custom parser? What about tokens? A complete grammar would shave off many many hours. Do you have a complete one? The one on your site seemed odd, but I can't remember why. I'll have to check again. BTW, I don't care if it's LR, LALR, or LL. I can convert them all.

In Canada, you can only transfer ownership of copyright. You can't put it in the public domain. At least there's no provision for doing so in the Copyright Act. I'm not a lawyer, but I doubt it matters much because intent is usually what's used in a court of law (as much as I hate them). Soonest I'll be able to get time to work on this is probably Feb, so we'll see. Either way, I think creds are a sign of respect.

Flat View: This topic has 4 replies on 1 page
Topic: Cat Source Code at CodeProject.com Previous Topic   Next Topic Topic: Cat is all about Tuples


Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us