Home

Awesome

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

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.