sudoblockio / tackle

Tackle is a programmable configuration language for building modular utilities, code generators, and CLIs with schema validation baked in.
Apache License 2.0
52 stars 2 forks source link

AST Upgrade #172

Open robcxyz opened 1 year ago

robcxyz commented 1 year ago

AST Upgrade

Upgrade string parsers to use an AST

Overview

Current parsing is based on regex which works in most use cases but has become:

  1. Very complex - Regex is basically unmaintainable

  2. Rigid - Can't use equal signs, just spaces

  3. Patched in multiple places where an AST strategy would be better

We currently use regex based parsing in:

tackle/utils/command.py - unpack_args_kwargs_string - Main CLI input string / hook call parser

tackle/parser.py - parse_complex_types - Parses types

Both of these parsers could benefit from a more structured tree based parser vs the current regex hack machine.

Steps