Updated
2 months
ago.
3 hacker ♥️.

How many times have you created quick and dirty script to generate C tables, parameterized code, etc. ?

Did the script ended up messy?

Is there a better way?

I've tried quite a lot of solutions but none of them worked really well and because of that I've decided to create a templating engine based on Python specialized for generating source code.

Example input that generates table of prime numbers:

```
#ifndef PRIMES_H
#define PRIMES_H
@ from math import sqrt
@ max_prime = 1000
unsigned int primes[] = {
2,
[@for](/users/for) i in range(3, max_prime+1,2)
@ is_prime = True
@ for j in range(3, int(sqrt(i)))
@ if i % j == 0
@ is_prime = False
@ endif
@ endfor
@ if is_prime
{{ i }},
@ endif
[@endfor](/users/endfor)
};
#endif /* PRIMES_H */
```

What is this useful for? There are number of use cases. One of the ideas is to generate syscall testcases from high level descriptions (a bit similar to what trinity does, but far more complete).

I already have a proof of concept ready, but it's far from complete solution.

#### Looking for mad skills in:

Nothing? Add some keywords!

#### This project is part of:

Hack Week 11

#### Activity

*over 4 years ago:*pluskalm liked A Python based C/C++ templating language

*over 4 years ago:*osukup liked A Python based C/C++ templating language

*over 4 years ago:*ebischoff liked A Python based C/C++ templating language

*over 4 years ago:*metan started A Python based C/C++ templating language

*over 4 years ago:*metan originated A Python based C/C++ templating language

#### Comments

#### Similar Projects

This project is one of its kind!