Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Cat - A Statically Typed Programming Language Interpreter in C#

, 4 Nov 2006
This article contains the public domain implementation of an interpreter for a statically typed stack-based programming language in C# called Cat. The accompanying article is a high-level description of how the various modules work, a brief description of the language, and links to related work.
/// Public domain code by Christopher Diggins
/// http://www.cat-language.com

using System;
using System.Collections.Generic;
using System.Text;

namespace Cat
{
    /// <summary>
    /// The config class contain global switches for controlling the behaviour 
    /// of the interpreter and compiler. 
    /// </summary>
    static class Config
    {
        /// <summary>
        /// Controls whether inferred types will be output to the console.
        /// </summary>
        public static bool gbLogTypeInference = true;
        
        /// <summary>
        /// Controls whether interpreter will run unit tests on start-up
        /// </summary>
        public static bool gbUnitTesting = true;
        
        /// <summary>
        /// Turns on tests which may throw exceptions. This is useful
        /// to trun off when in debug mode, and exception handling is 
        /// done from within the IDE.
        /// </summary>
        public static bool gbUnitTestingWithExceptions = false;
        
        /// <summary>
        /// Forces the interpreter to run the failing test set. 
        /// </summary>
        public static bool gbTestKnownIssues = false;
        
        /// <summary>
        /// Controls how names are assigned to type variable declarations and type variables
        /// </summary>
        public static bool gbSimpleTypeNames = true;
        
        /// <summary>
        /// Controls whether or not to display the welcome text.
        /// </summary>
        public static bool gbShowLogo = true;
        
        /// <summary>
        /// Controls whether type checking and type inference is used. 
        /// If you turn this off, then no type checking is done.
        /// </summary>
        public static bool gbStaticTyping = false;

        /// <summary>
        /// Determines whether the contents of the stacks is reported 
        /// after each line entry into the interpreter.
        /// </summary>
        public static bool gbOutputStack = true;
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Christopher Diggins
Software Developer Autodesk
Canada Canada
This article was written by Christopher Diggins, a computer science nerd who currently works at Autodesk as an SDK specialist.
Follow on   Twitter   Google+   LinkedIn

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141223.1 | Last Updated 4 Nov 2006
Article Copyright 2006 by Christopher Diggins
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid