ArgPar
Annotation-driven CLI argument parsing library for Java using reflection
Overview
ArgPar is a declarative CLI argument parsing library for Java that uses custom annotations to define command-line interfaces. Users annotate fields on plain Java classes with @ParsableArgument, @ParsableOption, or @ParsableFlag, and ArgPar uses reflection to introspect those fields, parse CLI arguments, convert string values to the target type, and populate the object at runtime. It supports positional arguments, named options, boolean flags, enum types, array types, custom types via the valueOf(String) convention, subcommand dispatch, and automatic help generation.
Highlights
- Designed a declarative annotation-driven CLI parsing library (~548 lines) that eliminates all imperative parsing boilerplate
- Built an extensible type system via reflection: the valueOf(String) convention allows any user-defined type to be parsable without modifying the library
- Implemented polymorphic parse dispatch with consumed-index tracking enabling order-independent argument/option/flag parsing
- Practical teaching tool used by students in the Compilers and Virtual Machines (PINS) course to control compiler phase execution
Related Projects
LintLokalization
Multi-threaded localization key validator for iOS/macOS/Android with IDE-native diagnostics
Multi-threaded CLI tool with manual thread pool, semaphore synchronization, and zero-contention work partitioning
Swift Code Generators
AST-based code generation tools that parse Swift source files and emit test/view boilerplate
Applied compiler theory to developer tooling: parse Swift source into ASTs and emit type-correct test boilerplate as a compiler phase problem