#parser #shell #scripting-language #ion #ion-shell

ion_shell_parser

Parser for the scripting language of the ion shell

1 unstable release

0.2.0 Apr 7, 2024

#515 in Programming languages


Used in ion_shell_lsp_server

MIT license

330KB
9K SLoC

Parser for the scripting language of ion shell

This provides a parse for scripting language of [ion shell]

Inner working of the parsing

Phase Tokenisation

Scripts are tokenized before the actual parsing. It determines all the special keywords, builtin commands, operators, assignment operators and words between the noise. Noises are white spaces, new lines or tabs. The tokeniser returns those noises as tokens too. These noises tokens are useful for formatting files. It also important for the syntactic of the script language of ion shell. Arguments within calls of commands and values in square brackets are separated by white spaces for example. Every token also has the location where it starts, line and column count. This property is needed by the LSP server to communicate with the client properly.
See this file for the rules of the tokenisation.

Phase Parsing

The parsing is concerned about the syntax of a script. Parsing solves the following problems:

  • Validate the correct order of tokens.

The formal grammar is documented under this file

Note

The parser detects if a script file sources another one. However it does not load the files automatically. It is up to the user to get the sourced file. However the parser as an iterator returns a marker item to tell the user if and which file is sourced.

Changelog

See the changelogs

Contributing

See the following guide lines

License

This project, all workspace members and the visual code extension are licensed under MIT License

Dependencies

~2.2–3MB
~59K SLoC