#bash #interpreter #subset #compiler

app srash

Bash interpreter/compiler. Will not support all the functionalities.

1 unstable release

0.0.0 Mar 22, 2023

#56 in #subset

21 downloads per month

MIT license

37KB
880 lines

Irsh

Description

Bash like interpreter and maybe compiler? Designed to be used as an interactive shell with minimal dependencies, will not support all bash syntax.

Features

  • support a unique bash syntax for variable/function declaration
  • always assume a { after a $ and that the brackets/parenthesis are correctly closed
  • ignore corner cases due to unclosed blocks/quote and crash for an easier (and faster?) implem
  • functions/program arguments with no default value are considered mandatory
  • one level of sub-command only
  • sub-commands can only be used at the beginning of double quoted string
  • sub-commands are limited to variables/words and redirection symbols
  • no support for nested quotes
  • no support (yet?) for multi-lines strings
  • value must be quoted when declaring a variable

Limitations

  • can fail on some edge cases
  • only &> redirection will be implemented
  • support only ${alphanum}, no $@ or $* or any other form
  • infinite loop if non closed sub-command
  • infinite loop if $() without the ""

Objectives

  • parse bash variables with scoping and defaults
  • parse bash functions via function keyword
  • support invocation of external commands
  • implement a subset of basic bash functionalities
  • support stdout/err redirections

No runtime deps