huntzhan / clidoc

Prove Of Conecept Fork Of Docopt.
MIT License
7 stars 1 forks source link

C++ code gen strategy for v0.1. #23

Closed huntzhan closed 9 years ago

huntzhan commented 9 years ago

There are two general procedures in clidoc:

  1. Analyze doc, collect necessary information for code gen.
  2. Generated specific code to process argv.

In v0.1, clidoc only support code gen for C++. Python and Rust would be supported in v0.2.

huntzhan commented 9 years ago

The goal of v0.1 is get things done, therefore the C++ code gen procedure would reuse the data structure of AST. Things might change rapidly in upcoming versions.

Idea of v0.1 code gen is as follow:

  1. The output of code gen is a .cc file that contains logic to build up the AST(might be a static function) and option record.
  2. Logic of everything else, i.e. consuming input arguments, would be implemented in src/gen_cpp.
  3. A CMake function will be provided as the interface of clidoc, which is responsible for loading doc, invoking code gen procedure, generating static libraries and so on.