Comments (4)
You see, the problem of making a code generator consists of 2 parts:
- implement a template for code that does not change (C)
- 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.
from docopt.c.
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.
from docopt.c.
Let's get back to this after we have implemented other features like positional arguments, commands and pattern matching?
from docopt.c.
@halst ok, after the str.replace I'll be looking at the C code
@kblomqvist ok
from docopt.c.
Related Issues (20)
- How are we going to handle the "struct DocoptArgs" element's names? HOT 2
- How Pattern C-struct could look like HOT 8
- Unit tests are broken HOT 2
- docopt.c does not support docopt's [options] shortcut HOT 1
- Running the example as described in the README doesn't work
- Default options don't work properly?
- Number of parsed tokens? HOT 2
- arguments not working HOT 3
- Use of uninitialized variables in `parse_shorts` and `parse_long`
- Unnecessary use of cat in README
- C-code generator based on yacc & lex
- Lib rather than generator? HOT 1
- Generate header file HOT 2
- We should not use __str__.replace() HOT 5
- Support for positional and ... arguments HOT 2
- Remove Python code from README
- Example not working
- missing template.c file HOT 4
- why is the main script called docopt.c.py instead of the initial docopt_c.py? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docopt.c.