Skip to content

lanicon/Nesp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nesp - A Lisp-like lightweight functional language on .NET

(Sorry, this project is deprecated. I'm started my own research project instead it. Currently closed source, but I'll open it near future.)

Nesp

AppVeyor Nesp

What's this?

  • Nesp is a Lisp-like lightweight functional language on .NET
  • Nesp is:
    • Very lightweight language syntax likely Lisp's S-expression.
      • A different topic is Nesp don't have "quote" expression.
      • Nesp expressions are lazy evaluation except literals.
    • Applicable .NET library.
    • Expandable tokens.
    • Designed for easy embedding and useful on REPL.

Nesp (REPL)

  • Still under construction...

Nesp standard type names

  • We can use C# like reserved type names (ex: int, short, string, double ...)
  • Additional reserved type names (guid, datetime, timespan, type, math, enum)

Nesp standard functions

  • Numerical operators (+, -, *, /, %)
  • TOOO: Declare function (define)

Nesp REPL functions

  • TOOO: Folder/file manipulations (ls, cd, mkdir)
  • Clear screen (cls)
  • REPL help (help)
  • REPL exit (exit)

Samples

  • Basic tips:
    • Nesp REPL mode not required brackets (...).

Literals

> 123
123 : byte
> 12345
12345 : short
> 1234567890
1234567890 : int
> 1234567890123456
1234567890123456 : long
> 123.456
123.456 : float
> 123.45678901234567
123.45678901234567 : double
> "abcdef"
"abcdef" : string

Property reference

> datetime.Now
7/21/2017 12:04:43 AM : datetime

Function invoke with no arguments

> guid.NewGuid
bb11b743-f5fe-4d68-bbe3-22e05606b3a5 : guid

Function invoke with arguments

> int.Parse "12345"
12345 : int
> System.String.Format "ABC{0}DEF{1}GHI" 123 456.789
"ABC123DEF456.789GHI" : string

Function invoke with nested invoking function expressions

  • If argument is nested invoking function and it has no arguments, you aren't required brackets.
    • This sample invokes Guid.NewGuid(), but NewGuid has no arguments:
> string.Format "___{0}___" System.Guid.NewGuid
"___7ded117e-c873-48cf-a00b-75c57b8aa317___" : string

Bind result

TODO:

> define fooValue (+ 123 456)
fooValue : int
> fooValue
579 : int

Bind function

TODO:

> define intParseAndAdd (str value) (+ (int.Parse str) value)
intParse : string -> int -> int
> intParse "12345"
12345 : int

License

History

  • 0.5.1 Public open.

About

A Lisp-like lightweight functional language on .NET

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 99.0%
  • ANTLR 1.0%