~leon_plickat/quetzal

[WIP] better evaluator
Some more work on the evaluator
Turn tokens into tree

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~leon_plickat/quetzal
read/write
git@git.sr.ht:~leon_plickat/quetzal

You can also use your local clone with git send-email.

Quetzal is a play-ground to develop a interactive-first shell with a LISP-ish
language.


# Syntax
The language has a LISP-like syntax, consisting of nested lists forming
S-expressions.

The first child of a list must be a string and will be interpreted as a command
that will act uppon all further children, which are the arguements.

The outer-most paranthesis must be left out.

	$ (echo (date)) # Wrong
	$ echo (date)   # Right


# Alternative (TODO)
Alternatively, S-Expressions could only be used for nesting commands and control
would be handled by more conservative syntax.


# Not a LISP
Despite the similar syntax, quetzal is not actually a LISP. Notable differences
are the lack of self reflectiveness and cons cells.


# Types
Quetzal has three types: String, Number, Nil

Nil functions as a placeholder for an empty S-Expression.


# Build-ins
	(@map a b)             -> execute command b for all values of a
	(@eval a)              -> eval string a as command -> do we want to supported nested commands in eval?
	(@concat a b)          -> concatenates multiple strings (numbers will coerce to strings here) or a single string
	(@space-concat a b)    -> like above, but input strings will be whitespace separated
	(@set variable value)  -> set the value of a variable, variables may have any of the types
	(@get variable)        -> returns value of a variable or Nil if variable unset
	(@getenv variable)     -> set env var, always a string
	(@setenv variable)     -> get env var, always a string or Nil
	(@nil? a)              -> returns true if a is Nil, false otherwise
	(+ a b c), (* a b c), (- a b c), (/ a b), etc...


# Pipes (TODO)
How to do pipes?

	(first (block)) | (second (block))     <- very similar to POSIX, familiar

	(pipe (command one) (command two))     <- fits out syntax better, BUT BREAKS OUR RULES by not evaluating the commands in before

	(pipe "command one" "command two")     <- works within the rules, but awkward


# Non-Features
- "rich piping": Many modern shells have a way to pipe and work on rich data,
                 meaning data that is more than just strings. Quetzal will never
                 have this. While a novel idea, it is not very practical because
                 all CLI utilities take and output just strings. So rich data
                 is barely ever used even in those shells _and_ requires a ton
                 of built-ins to deal with it.
- any features for scripting: Quetzal is strictly a shell for interactive use only.