Code Monkey home page Code Monkey logo

shen_run's Introduction

shen_run

Shen REPL trampoline.

It loads a ~/.shen.shen initialization file, which is convenient for modulesys users. It can execute Shen scripts, allowing them to access command line arguments. Error output is written to stderr.

Installing

For each Shen implementation, you can build separate version of shen_run. If you want to build shen_run for shen-sbcl then

mkdir include/sbcl
cp include/config.def.h include/sbcl/config.h.

Edit include/sbcl/config.h to match your configuration. Then type

make impl=sbcl

to build shen_run_sbcl.

N.B. The default impl is sbcl.

Using

Your script must have an entry function main, which accepts command line parameters in one argument of type (list string) and returns a boolean indicating success status. You can run that script either by typing

shen_run_[impl] your_script.shen argument1 argument2 ...

Or you can add a line

#!/usr/bin/env shen_run

at the top of your script and make it executable

chmod +x your_script.shen

Then you can run it as any other program:

./your_script.shen argument1 argument2 ...

Example

Located at src/example.shen.

#!/usr/bin/env shen_run_sbcl

(define show-args
  [] _ -> _
  [X | R] I -> (let - (output "  ~A: ~S~%" I X)
                 (show-args R (+ I 1))))

(define main
  [] -> (error "Not enough arguments.")
  ["-preved" | _] -> false
  Args -> (let - (output "Arguments~%")
               - (show-args Args 0)
               - (output "End~%")
               true))

shen_run's People

Contributors

gravicappa avatar yurrriq avatar

Watchers

 avatar  avatar

shen_run's Issues

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.