#bash #interpreter #subset #compiler

app birsh

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

1 unstable release

0.0.0 Mar 20, 2023

#60 in #subset

MIT license

25KB
605 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

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