docopt / docopt.c

C-code generator for docopt language.
MIT License
318 stars 46 forks source link

IMO, repo has clutter #3

Closed ffunenga closed 8 years ago

ffunenga commented 11 years ago

I dont understand why the following files are in the repository:

IMO, all the files in the upstream repo should have a justification why they are where they are.

I know @halst and @kblomqvist have shown their preference for all files go to level 0 but I don't see any reason why NOT to:

keleshev commented 11 years ago

You see, the problem of making a code generator consists of 2 parts:

  1. implement a template for code that does not change (C)
  2. implement generator which uses template to generate code (Python)

In our case the problem (2) is easy—just some string manipulation, and the problem (1) is hard—we need to implement a big subset of docopt functionality in C (the part of functionality that occurs at run-time and, thus, we cannot reuse Python implementation for that).

That is why we need test_docopt.c—tests for the hard problem. We also use docopt.c, because we cannot test template, we need to test some C code that could be compiled. log.h is just handy during development, it will be removed eventually.

keleshev commented 11 years ago

I noticed that you're mostly targeting the (2) problem and almost dismissing the (1). You should take a closer look at it. Right now docopt.c supports only options and no pattern-matching. The pattern-matching needs to be implemented in C, since it happens during the run-time of the end-user program, and it's a hard task.

kblomqvist commented 11 years ago

Let's get back to this after we have implemented other features like positional arguments, commands and pattern matching?

ffunenga commented 11 years ago

@halst ok, after the str.replace I'll be looking at the C code

@kblomqvist ok