Skip to content

Simple lisp style command line interpreter (repl) especially for embedded system.

Notifications You must be signed in to change notification settings

jks-liu/lisp-style-repl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lisp Style REPL

Simple lisp style command line interpreter (REPL) especially for embedded system.

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Version number SHALL be compatible with Semantic Versioning.

Acronym used in documents and source files

  • REPL: Read Evaluate Print & Loop
  • CLI: Command Line Interface

How to use

;; Command MUST in one line
;; Nested parentheses SHALL NOT be used
(command arg0 arg1 ...)

C APIs

standard: C99

All extern function or variable SHALL in the namespace 'lsr_', 'Lsr_' OR 'LSR_' which is short for Lisp Style Repl.

The C APIs SHALL NOT reentrant. Which means it is not thread-safe.

Built-in command

;; All built-in command SHALL return 0 if success or 1 if fail.
;; Except ($?) will return the same value as the last command
;; 
;; Show last command return value
($?)
;; Show all commands and a brief introduction.
(help)
;; Show manual of a specific command.
(man command)
;; + - * / (TODO)
(+ num0 num1 ...)
(- num0 num1 ...) ; num0 - num1 - num2 - ...
(* num0 num1 ...)
(/ num0 num1 ...) ; num0 / num1 / num2 / ...

Initialize and add your own command

You will get a example in test/ directory.

A command named "copyright" MUST be implemented.

A command including built-in command which return non-zero SHALL be considered a error, So the ($?) will return a error even it executed successfully.

Command return value MUST in range [0, 256), this range is POSIX-compatible.

Use C++ ?

There are something wrong c++

Please refer test-cpp/ for details to fix errors.

Authentication

TODO

License

Copyright 2013 jks Liu. Some right reserved.

License: BSD.

About

Simple lisp style command line interpreter (repl) especially for embedded system.

Resources

Stars

Watchers

Forks

Packages

No packages published