= = = SILC (SIMPLE INTEGER AND LIST CODE) = = =

Designed and Implemented by Jack Eisenmann

SILC is an interpreted programming language which is 50% joke and 50% "serious business". Features include:

To use SILC, download the source code and compile it. Use GCC or something. If you have a Mac, you can download the compiled binary.

SILC is newline sensitive, but not space or tab sensitive. A program consists of newline separated commands. Each command has the following format:

(function value) (argument) (argument) (argument)...

For example:

PRINT "HELLO"

SILC has three data types: 64-bit signed integer, variable size list, and function reference.

An integer literal consists of a whole number. Ex: 58, 7. No major surprises here.

A list literal consists of space separated expressions enclosed by curly braces. Ex: {2 4 8 16 32 64}.

A string literal consists of characters enclosed by quotation marks. Ex: "HELLO". Use a backslash to write a quotation mark or newline in a string. Ex: "I SAY \"HOWDY\" TO YOU.\nTHIS IS ANOTHER LINE." Remember that strings are actually lists of ASCII code integers.

SILC supports many of the standard C operators:

-# + - * / % ~ | & ^ ! || && == != > >= < <= []

Note that the -# operator is the unary negation operator.

Here is a list of every built-in SILC function:

DECLARE (name): Declares a variable in the given scope.

KEEP (value) (destination): Stores the given value in the destination.

IS_INTEGER (value) (destination): Determines whether the given value is an integer.

IS_LIST (value) (destination): Determines whether the given value is a list.

IS_FUNCTION (value) (destination): Determines whether the given value is a function.

GET_LENGTH (list) (destination): Retrieves the length of the given list.

SET_LENGTH (length) (list): Sets the length of the given list. Either truncates the list or extends the list with zeroes.

IF (condition): Executes the following code block only if the given condition is true.

END: Terminates the current code block.

ELSE_IF (condition): Executes the following code block if the given condition is true and none of the preceding conditions were true.

ELSE: Executes the following code block if none of the preceding conditions were true.

WHILE: Executes the following code block while the given condition is true.

CONTINUE: Jumps to the beginning of the current WHILE loop.

BREAK: Jumps outside to the end of the current WHILE loop.

FUNCTION (function name) (arg name) (arg name) (arg name)...: Declares a variable containing a function. The function is defined by the given argument variable names and the following code block. Arguments are passed by reference.

RETURN: Exits from the current function.

PRINT (list): Prints the given string.

PROMPT (destination): Prompts a string from the user.

IMPORT (file name): Imports the given file and executes the code in the file.

Comments are preceded by a number sign. Ex: # WACKY COMMENT. Each comment must be placed on its own line.

Example code (prime number generation):

FUNCTION IS_PRIME INPUT_NUMBER DESTINATION
    DECLARE FACTOR
    KEEP 2 FACTOR
    WHILE FACTOR < INPUT_NUMBER
        IF INPUT_NUMBER % FACTOR == 0
            KEEP 0 DESTINATION
            RETURN
        END
        KEEP FACTOR + 1 FACTOR
    END
    KEEP 1 DESTINATION
END

DECLARE NUMBER
KEEP 2 NUMBER
WHILE NUMBER < 100
    DECLARE RESULT
    IS_PRIME NUMBER RESULT
    IF RESULT
        PRINT NUMBER
    END
    KEEP NUMBER + 1 NUMBER
END

SILC libraries:

Other resources:

Return to the Ostracod Pond