1. Geonu Choi
  2. Resoup

Overview

HTTPS SSH

RESOUP

Author

Resoup was written by Hardtack[:]

Description

Resoup is interpreter of Lisp dialect

Installation

cd [path for directory of resoup]

type make

type "./resoup" to run resoup

Syntax

Syntax of resoup is based on lisp family language

  • The first element of list is 'Procedure' and others are arguments of 'Procedure'

    For example:

    ([Procedure] [Argument1] [Argument2] ...)

    $ ./resoup
    Welcome to RESOUP!
    > (+ 1 2)
    3
    

    In this example '+' is procedure, '1', '2' are arguments of '+'

  • To define variable type (define [variable name] [value])

    For example:

    $ ./resoup
    Welcome to RESOUP!
    > (define a (+ 1 2))
    > a
    3
    
  • To make procedure type (lambda "List of argument's name" "description of procedure")

    For example:

    $ ./resoup
    Welcome to RESOUP!
    > (define add (lambda (x y) (+ x y)))
    > add
    <Procedure:add>
    > (add 3 5)
    8
    
  • To load external source code type (load "[path for source code]")

    For example:

    $ ./resoup
    Welcome to RESOUP!
    > (load factorial.rs)
    ********** Source code **********
    
    (define factorial (lambda (x) (if (> x 1) (* x (factorial (- x 1))) x)))
    (display "Factorial defined!")
    
    ******** Source code ends ********
    
    Factorial defined!
    > (factorial 5)
    120
    

    factorial.rs:

        (define factorial (lambda (x) (if (> x 1) (* x (factorial (- x 1))) x)))
        (display "Factorial defined!")
    
  • To quit recoup call 'exit' procedure

    For example:

    ./resoup
    Welcome to RESOUP!
    > (exit)
    

Options

  • -p [Path for source code]

    run with pre-written source code For example:

    $ ./resoup -p factorial.rs
    Welcome to RESOUP!
    ********** Source code **********
    
    (define factorial (lambda (x) (if (> x 1) (* x (factorial (- x 1))) x)))
    (display "Factorial defined!")
    
    ******** Source code ends ********
    
    Factorial defined!
    > (factorial 5)
    120
    

    factorial.rs:

    (define factorial (lambda (x) (if (> x 1) (* x (factorial (- x 1))) x)))
    (display "Factorial defined!")
    
  • -l "[One line source code]"

    Run with one line source code For example:

    $ ./resoup -l "(+ 1 2)"
    Welcome to RESOUP!
    3