tokiwa-software / fuzion

The Fuzion Language Implementation
https://fuzion-lang.dev
GNU General Public License v3.0
46 stars 11 forks source link

base library: provide a parser for command line args #605

Open maxteufel opened 1 year ago

maxteufel commented 1 year ago

Since we now support command line args in both backends (#156), perhaps we want to provide some features to easily parse these. C has getopt(3), Go has the flag package in the standard library, Python has the argparse module in the standard library.

michaellilltokiwa commented 1 year ago

I work on a parser combinator library inspired by rusts nom here: https://github.com/michaellilltokiwa/fuzion/blob/lib/modules/nom/modules/nom/src/nom.fz https://github.com/michaellilltokiwa/fuzion/blob/lib/modules/nom/tests/nom/nom_test.fz

But some bugs in fuzion need to be fixed first for this to work.

maxteufel commented 1 year ago

@michaellilltokiwa I think using general purpose parser for this is overkill. It should be sufficient to work with string.startsWith, string.substring, and string.split.

michaellilltokiwa commented 1 year ago

I disagree, sorry :-D I think the string.startsWith() way is actually more complicated in most but the easiest cases.