How piratelang/pirate works
Pirate is a toy programming language with a command-line shell. Its principal workflow starts with a source file, lexes it into tokens, parses tokens into a scope, and interprets that scope to produce values; the parser also serializes its scope. The tree documents standard terminal and string functions, shell project/module commands, and shared file, environment, and logging services. Lexer implementation files are absent from the supplied tree, so its node has no source path. Some internal runtime and shell-command wiring is consequently not shown.
Main entry points: Application.cs Shell application · Parser.cs Parser · ObjectSerializer.cs Object serializer · Interpreter.cs Interpreter
Components 24
Language pipeline
- Lexer
- Token types
Pirate.Lexer.TokenType/TokenTypeMapper.cs - Parser
Pirate.Parser/Parser.cs - Statement parsers
Pirate.Parser/Parsers - Parsed scope
Pirate.Parser/Scope.cs
Interpreter runtime
- Interpreter
Pirate.Interpreter/Interpreter.cs - Node interpreters
Pirate.Interpreter/Interpreters - Runtime state
Pirate.Interpreter.Runtime/Runtime.cs - Runtime values
Pirate.Interpreter/Values - Standard library
Pirate.Interpreter.StandarLibrary/StandardLibraryProvider.cs - Terminal functions
Pirate.Interpreter.StandarLibrary/Standard/Terminal - String functions
Pirate.Interpreter.StandarLibrary/Standard/String
Shell and projects
- Shell application
Shell/Application.cs - Shell commands
Shell/Commands - Run command
Shell/Commands/RunCommand.cs - Project files
Shell.Project/ProjectFileHandler.cs - Module list
Shell.ModuleList/ModuleListRepository.cs
Shared services
- Object serializer
Pirate.Common/ObjectSerializer.cs - File handlers
Pirate.Common.FileHandler - Environment config
Pirate.Common/EnvironmentVariables.cs - Logger
Pirate.Common.Logger/Logger.cs
Other components
- Language user
- Pirate source
- Local files
Connections 23
- Language user → Shell application: invokes
README.md - Language user → Pirate source: writes
README.md - Pirate source → Lexer: lexes
README.md - Lexer → Token types: maps tokens
- Lexer → Parser: provides tokens
README.md - Parser → Statement parsers: dispatches parsers
Pirate.Parser/Parser.cs - Parser → Parsed scope: adds nodes
Pirate.Parser/Parser.cs - Parser → Object serializer: serializes scope
Pirate.Parser/Parser.cs - Shell application → Run command: routes commands
Shell/Application.cs - Run command → Parser: runs pipeline
- Shell application → Interpreter: runs interpreter
Shell/Program.cs - Interpreter → Node interpreters: visits nodes
README.md - Node interpreters → Runtime values: produces values
README.md - Interpreter → Runtime state: uses runtime
Pirate.Interpreter.Runtime/Runtime.cs - Standard library → Terminal functions: registers functions
Pirate.Interpreter.StandarLibrary/StandardLibraryProvider.cs - Standard library → String functions: registers functions
Pirate.Interpreter.StandarLibrary/StandardLibraryProvider.cs - Shell application → Project files: handles projects
- Shell application → Module list: manages modules
- Object serializer → File handlers: reads and writes
Pirate.Common/ObjectSerializer.cs - File handlers → Local files: accesses files
Pirate.Common.FileHandler/FileReadHandler.cs - Object serializer → Environment config: gets location
Pirate.Common/ObjectSerializer.cs - Object serializer → Logger: logs operations
Pirate.Common/ObjectSerializer.cs - Logger → File handlers: appends logs
Pirate.Common.Logger/Logger.cs