1 unstable release
| 0.0.1 | Apr 14, 2023 |
|---|
#8 in #beer
6KB
Lingy
A Modern Acmeist Lisp Dialect
Synopsis
Run the Lingy REPL:
$ lingy
Welcome to Lingy [perl]
user> (prn "Hello, world!")
"Hello, world!"
nil
user>
or a Lingy one-liner:
$ lingy -e '(println "Hello, world!")'
Hello, world!
or run a Lingy program file:
$ echo '(println "Hello, world!")' > hello.ly
$ lingy hello.ly
Hello, world!
or run an example Lingy program:
$ curl -sL https://raw.githubusercontent.com/ingydotnet/lingy/main/eg/99-bottles.ly | lingy - 3
3 bottles of beer on the wall
3 bottles of beer
Take one down, pass it around
2 bottles of beer on the wall.
2 bottles of beer on the wall
2 bottles of beer
Take one down, pass it around
1 bottles of beer on the wall.
1 bottles of beer on the wall
1 bottles of beer
Take one down, pass it around
0 bottles of beer on the wall.
Description
Lingy is a Lisp dialect written in many languages, including: Perl.
Clojure is a Lisp dialect that compiles to run on the JVM.
ClojureScript uses the same Clojure source code but compiles to NodeJS.
Lingy is the runtime that supports the YAMLScript language.
YAMLScript is meant to be implemented in all the same languages as Lingy.
Lingy is heavily influenced by the Clojure (Lisp) language. It aspires to be largely interoperable with Clojure. Currently it supports just a tiny subset of Clojure but supports Lisp basics like function application and macros.
Lingy started as a Perl implementation of the Make a Lisp project. This provided a bare-bones Clojure-inspired Lisp interpreter.
lingy CLI Usage
The Lingy language installs a command lingy.
You can use this command to run Lingy programs, start a Lingy REPL or run
Lingy one-liner expressions.
-
lingy --repl(or justlingy)Starts a Lingy interactive REPL. The REPL has readline support that includes:
- Command history
- CTL-R searching
- Parentheses match highlighting
- CTL-C to abort a command w/o leaving REPL
Use CTL-D to exit the REPL
-
lingy program.ly foo barRun a Lingy program passing in arguments. Arguments are available in Lingy as
*ARGV*. -
cat program.ly | lingy - foo barRun a Lingy program from STDIN and pass in arguments. The
-means run from STDIN instead of a file. If there are no arguments you can omit the-. -
lingy -e '(println "Hello" (nth *ARGV* 0))' worldRun a Lingy one-liner with arguments.
When used with
--repl, run the-ecode first, then enter the REPL.
lingy CLI Options
-
-e <string>,--eval=<string>A Lingy string to evaluate.
-
-r,--replStart a Lingy REPL. Can be used with
-e. -
--pppPrint the Lingy compiled AST for a
-eexpression. -
--xxxYAML dump the Lingy compiled AST for a
-eexpression.
Supported Functions
*+-/<<====>>=apply*ARGV*assocatomatom?catchconcatcondconjconscontains?countdecdefdefmacroderefdissocdoempty?evalfalsefalse?*file*firstfnfn?getgetenvhash-map*host-language*ifjoinkeyskeywordkeyword?letlistlist?load-filemacro?macroexpandmapmap?metanilnil?notnthnumbernumber?printlnprnpr-strquasiquotequasiquoteexpandquoterangereadlineread-stringreset!restseqsequential?slurpstrstring?swap!symbolsymbol?throwtime-mstruetrue?tryvalsvecvectorvector?with-metaPPPWWWXXXYYYZZZ
Roadmap
The next major things to add are:
- Multi-arity function/macro definition and application
- Namespaces
- Lambdas
- lingy.core libary
- Regex support
See Also
Status
Lingy is in ALPHA status.
Authors
- Ingy döt Net [email protected]
Copyright and License
Copyright 2023 by Ingy döt Net
This is free software, licensed under:
The MIT (X11) License