Coder Social home page Coder Social logo

cat-language's Introduction

Cat Interpreter, http://www.cat-language.com
Copyright 2008, by Christopher Diggins

Executable licensed under the MIT License (see license.txt)
All source files are public domain

NOTE:
Don't forget to load the standard library by passing "everything.cat" as a command-line argument.

To compile the source code you can use the Microsoft Visual C# Express edition.
You can download it for free at:

  http://msdn.microsoft.com/vstudio/express/visualcsharp/

Or the open-source Mono compiler version 1.2 or later:

  http://www.mono-project.com/Downloads

To compile with mono on Windows use the files "mono_build.bat", or if graphics give you a problem
use "no_graphics_mono_build.bat". If you are using Mac, Linux, or other, open these files to see
the neccessary command-line options for running Mono.

To report bugs go to:

  http://code.google.com/p/cat-language/issues/list

To get the latest download go to:

  http://code.google.com/p/cat-language/downloads/list

To join the Cat discussion group and mailing list go to:

  http://groups.google.com/group/catlanguage

For a Cat tutorial go to:

  http://www.cat-language.com/tutorial.html

The Cat manual/specification is at:

  http://www.cat-language.com/manual.html

Most importantly, have fun!

Christopher Diggins
http://www.cdiggins.com

cat-language's People

Watchers

 avatar

cat-language's Issues

qv Referred to doesn't seem to be a valid primitive

The manual (http://www.cat-language.com/manual.html) refers to a construct
qv which seems to be identical to quote.  The only reference I could find
for qv in the primitive reference is one or two places that use it.  Should
this be replaced with quote?

Original issue reported on code.google.com by [email protected] on 3 Oct 2007 at 8:09

Can not parse floating literal in non-english locale

When locale defines decimal separator as comma, not dot, the grammar is not in 
sound with parser: grammar tells to read dot (and interpreter does it), but 
then parser can not recognize floating point literal as it expects comma 
instead of dot.

Can be (and is) solved by parsing in this vay:

value = double.Parse(ToString(), 
System.Globalization.CultureInfo.InvariantCulture.NumberFormat);

Thanks!

Original issue reported on code.google.com by [email protected] on 23 Jan 2012 at 9:34

Definition of whilene not working

What steps will reproduce the problem?
1. Implement the level 0 primitives
2. Implement a way of defining the level 1 primitives using level 0 primitives
3. Attempt to define whilene and the other level 1 primitives (about 17)
that depend on it, and run all of the unit tests.

What is the expected output? What do you see instead?

The expected output in all cases should be the stack containing only true
-- specifically each of the tests should pass.  Instead, you see uncons (or
some other list opeartion) complain because it ends up being called on
something that isn't a list.

Please provide any additional information below.

The reason for this problem is that the definition of whilene in the
primitives documentation online is stated as:
   Implementation   [empty not] while pop
Unfortunately, the first time this executes the (empty not), the list will
be taken off the stack (see the definition of empty).  To fix this, change
the definition to
   Implementation   [dup empty not] while pop
This will make a copy of the list on the top of the stack, then replace the
top copy with whether it is empty.  This will make everything work.  I have
done this on my scheme implementation of all of the primitives from level 0
and 1 (except for the combinators) and this is the only way to get all of
the unit tests to pass.

Original issue reported on code.google.com by [email protected] on 25 Sep 2007 at 6:44

Full type-checking not performed

Final types are not checked (e.g. int and string are considered 
compatible).

Original issue reported on code.google.com by cdiggins on 21 Oct 2007 at 2:11

Method Lookup and Resolution

The dynamic method resolution algorithm has some bugs.

Original issue reported on code.google.com by cdiggins on 7 Apr 2007 at 5:59

Example of factorial is incorrect

What steps will reproduce the problem?
1. Enter the code for factorial online (see below for link)
   define rec_fac
      { dup 1 > [] [dec rec_fac *] if }
2. Attempt to compute the factorial of some number (specefically, 1 and
something greater than 1).

What is the expected output? What do you see instead?
Two problems occur.  In the base cases this recurses instead of doing
nothing, so the comparison is flipped (or the blocks are in the wrong
order).  Second, once that works the recursive case computes n - 1, then
the factorial of that, and then does multiply -- but there is nothing else
on the stack.  Hence, we need an additional dup.

Here is a working version of the above function as tested in my scheme
interpreter.
   (define-cat rec_fac => 
     dup 1 lteq_int [] [dup dec rec_fac mul_int] if)

Please provide any additional information below.
http://www.cat-language.com/manual.html

Original issue reported on code.google.com by [email protected] on 3 Oct 2007 at 6:34

enhancement: make online interpreter allow stepping through

When running a complex program in the online interpreter, such as a bin_rec
program, or a map, etc., it would be very helpful to be able to step
through the program one step at a time. As in a debugger. And to see the
state of the stack after each step.

Original issue reported on code.google.com by [email protected] on 23 Apr 2008 at 6:37

Partial Evaluator is broken

The partial evaluator no longer works correctly.

Original issue reported on code.google.com by cdiggins on 21 Oct 2007 at 2:12

Possible type inference bug

What steps will reproduce the problem?
define is0or1 { dup 0 == swap 1 == or }

What is the expected output?
function defined: is0or1 ( int -> bool )

What do you see instead?
exception from type inference engine

What version of the product are you using? On what operating system?
Cat 0.16, Windows XP, C# Express 2005

Original issue reported on code.google.com by [email protected] on 18 Jul 2007 at 11:31

Primitives need meta-comments

I want all primitives to be represented in Cat source code files, with 
tests, documentation, type, etc. 

This way a file parser can get the information out of the source code 
files, without needing to hack/read the source code. 

Original issue reported on code.google.com by cdiggins on 22 Oct 2007 at 3:50

Code runs, or graphics draws, more than once or not at all

This may be due to macro expansion or a bug in CatGraphWindow or both.
File attached.

typed:
hilbert
expected: a loop to be drawn (once) and the turtle to take the paint pot
with him.
got: the loop flashed as it was drawn.
Gets slower like Shlemiel the Painter's algorithm described on
http://www.joelonsoftware.com/articles/fog0000000319.html

hilbert pop // (all on one line)
expected: loop should be drawn
got: nothing happened. Does the type system believe this has no effect?

hilbert // (on two separate lines)
st
expected: turtle to appear on st
got: the curve was drawn again


What version of the product are you using? On what operating system?
Cat 0.16, Windows XP, C# Express 2005

Original issue reported on code.google.com by [email protected] on 18 Jul 2007 at 11:45

Attachments:

Graphics bug with user-defined functions calling user-defined functions

User defined functions can't be used within other user-defined functions 
after the initial open-window call. This is because the scope gets 
duplicated in the window's version of the executor stack, and new 
definitions aren't added to it. 

Original issue reported on code.google.com by cdiggins on 25 Apr 2007 at 10:49

'dhead drop' not as expected

What steps will reproduce the problem?
1. [1 2 3] list 
2. dhead
3. drop

What is the expected output? 
stack: (1,2,3) 

What do you see instead?
stack: ()

What version of the product are you using? On what operating system?

0.18.2 on Windows XP 
Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 31 Dec 2007 at 3:41

Type inference on lists

What steps will reproduce the problem?
define lookup : ( int -> int ) { (2,3,5,7,11) swap nth nip }

What is the expected output?
type: (int -> int)

What do you see instead?
type error in function lookup
inferred type (int -> any)
declared type (int -> int)

What version of the product are you using? On what operating system?
Cat 0.16

Please provide any additional information below.
Hopefully 0.17 support for "statically typed homogeneous lists" will fix this.

Original issue reported on code.google.com by [email protected] on 20 Jul 2007 at 5:10

Confusing Error on Manual

and type-vector variables which are are identified by an apostrophe and a
name starting with a ****lowercase letter**** ('A, 'Myvar).

This is found on http://www.cat-language.com/manual.html.

I believe lowercase here should be uppercase. I had to read it three times
before I picked up on this.

Original issue reported on code.google.com by [email protected] on 30 Oct 2007 at 12:54

CatList and CatStack could be merged

The CatList and CatStack class are more or less the same thing and should 
probably be merged.

Original issue reported on code.google.com by cdiggins on 1 Apr 2007 at 5:57

Typo on Website.

On page http://www.cat-language.com/metacat.html

In the matching paragraph there is a typo 'implementatino.' should be
implementation.

Original issue reported on code.google.com by [email protected] on 29 Oct 2007 at 4:39

example of conditional is incorrect

What steps will reproduce the problem?
1. In Conditionals section of tutorial
(http://www.cat-language.com/tutorial.html), read the example code:
    1 1 +
    eq 2
    ["As I expected!"]
    ["I need to be repaired!"]
    if
Note that "eq" before the 2 makes no sense: at that point, there is only
one value on the stack, therefore eq (which takes two arguments) should
cause an error. Presumably, the intended code was 
    1 1 +
    2 eq
    ...
2. Enter the sample code in the interpreter: 1 1 + eq 2
What is the expected output?
true (on the stack)
 What do you see instead?
false 2 (on the stack)

What version of the product are you using? On what operating system?

Tutorial at http://www.cat-language.com/tutorial.html as of April 21, 2008.

Please provide any additional information below.

Cool language, enjoyed the Dr Dobbs article.

Original issue reported on code.google.com by [email protected] on 22 Apr 2008 at 5:11

typos on http://www.cat-language.com/

http://www.cat-language.com/

Joy link: http://www.latrobe.edu.au/phimvt/joy.html
«langauge» -> «language»

http://www.cat-language.com/tutorial.html

«experssion» -> «expression»
«Becaue» -> «Because»
«cosntructor» -> «constructor»
«the to write» -> ???
«to to each it» -> ???
«foreach» -> «for_each» ?

Original issue reported on code.google.com by [email protected] on 24 Apr 2012 at 7:27

No static type checking or type inference

The current release of the Cat interpreter does not support type inference 
or type checking at compile-time. Any [TypeAnnotation type annotations] 
are  parsed correctly but ignored.

Original issue reported on code.google.com by cdiggins on 30 Mar 2007 at 7:34

Recursive Types not Handled Well

Some recursive programs "dup apply" etc. now are no longer legal, however 
others are. The problem is that it is not clear where the distinction is 
between legal recursive programs and non-legal recursive programs. 

Original issue reported on code.google.com by cdiggins on 22 Oct 2007 at 6:33

No import/load module statement

There is no way to load/import/includ a module/code file other than 
directly on the command line. 

Original issue reported on code.google.com by cdiggins on 1 Apr 2007 at 5:28

Turtle Graphics Library

I want a logo-style turtle graphics library. Some of the framework already 
exists. For example, we have windows that operate on a single thread. 

Original issue reported on code.google.com by cdiggins on 1 Apr 2007 at 5:31

map should expect a function : ( any -> any )

What steps will reproduce the problem?
(1,2) [dup] map

What is the expected output?
Either: (1,1,2,2)
 or: Error, expected function which leaves stack balanced at [dup]
as argument for 'map'

What do you see instead?
Throws uncaught exception, auxilliary stack becomes unbalanced

What version of the product are you using? On what operating system?
Cat 0.16, Windows XP, C# Express 2005

Original issue reported on code.google.com by [email protected] on 18 Jul 2007 at 11:55

Optimization: Invocation of Higher Order List Functions

Higher order list functions use an auxiliary stack. It strikes me as a 
very inefficient and possibly buggy way to deal with them. I have to fix 
it. 

Original issue reported on code.google.com by cdiggins on 12 May 2007 at 5:33

lteq: interpreter disagrees with description

What steps will reproduce the problem?
1. In cat online interpreter, type 1 3 <enter>. Note 3 is now on top of the
stack. 1 is second (if I'm understanding "top" and "second" correctly).
2. Now type lteq <enter>.
3.

What is the expected output?
false (pushed onto the stack in place of 3 and 1).
http://www.cat-language.com/primitives.html#lteq says "desc:
Pushes true if the top value is less than or equal to the second value,
false otherwise." 3 is not <= 1.
 What do you see instead?
true on top of the stack
Am I just nuts?

What version of the product are you using? On what operating system?
cat interpreter 1.3, Firefox 2.0.0.14

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 23 Apr 2008 at 6:02

Better parsing errors

The current parsing error reporting mechanism is poor. 
I want to highlight the line and character index. 

Goal: fix by mid-June.

Original issue reported on code.google.com by cdiggins on 7 May 2007 at 11:45

describe bin_rec

The docs for bin_rec at http://www.cat-language.com/primitives.html#bin_rec
say:
('a ('a -> bool) ('a -> 'b) ('a -> 'C 'a 'a) ('C 'b 'b -> 'b) -> 'b)
  {{ desc:
      execute a binary recursion process"
The text part is not very specific. What are the 5 arguments on the input?
All I can tell from the type signature is that the 5th one ('a) is a
starting value and the 4th (('a -> bool)) is a termination condition.
It kinda looks like the 3rd is what to do in the base case; 2nd is a
splitting function and 1st is a folding function. But it would be nice to
have that in the desc if correct.
(Ah... the Dr Dobbs article lists the arguments as "input, cond, term,
unfold, fold". It would be good to have that in the desc if it is still true.)

Also, it would be nice to have bin_rec implemented in the online
interpreter, since it is featured prominently in the DDJ article.

bin_rec was 

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 23 Apr 2008 at 6:31

Flatten not working

What steps will reproduce the problem?
((1)(2)) flatten

What is the expected output?
Stack: (1,2)

What do you see instead?
uncaught exception, stack was not displayed

What version of the product are you using? On what operating system?
Cat 0.16, Windows XP, C# Express 2005

Original issue reported on code.google.com by [email protected] on 18 Jul 2007 at 11:32

Types not shown when defining

When defining new functions, the inferred type should be output.

Original issue reported on code.google.com by cdiggins on 21 Oct 2007 at 4:43

"[dup] m" does not type

"[dup] m" returns "( -> 'a 'a)" which is clearly wrong. 

Possibly the problem is the rolling up phase.

Original issue reported on code.google.com by cdiggins on 21 Oct 2007 at 5:50

Floating points print-out like Integers


What steps will reproduce the problem?
1. Type in 1.0

What is the expected output? 
stack: 1.0

What do you see instead?
stack: 1

Original issue reported on code.google.com by cdiggins on 30 Mar 2007 at 12:34

Interpreter

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?


Please use labels and text to provide additional information.


Original issue reported on code.google.com by cdiggins on 12 May 2007 at 5:30

Help command is insufficient

What steps will reproduce the problem?
1. type in help



Original issue reported on code.google.com by cdiggins on 30 Mar 2007 at 12:35

Type signature parsing error

('A -> 'B) -> ('A -> 'B)

This is an illegal type signature but is parsed successfully

Original issue reported on code.google.com by cdiggins on 21 Oct 2007 at 2:09

Typo

Typo is found on
http://www.cat-language.com/tutorial.html

Under the expressions section.  There is a repeat of the such as 'the the', 
actual caption

higher-order languages and """the the""" theory of languages.

Original issue reported on code.google.com by [email protected] on 15 Nov 2007 at 12:40

List Comprehensions are Missing

List comprehensions are missing and have to be added.


Original issue reported on code.google.com by cdiggins on 21 Oct 2007 at 2:13

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.