| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A tool that uses formal specification and natural language specifications to generate formally verified C code automatically. The tool uses Large Language Models (LLMs) to generate code based on the given specifications. The generated code is then verified using Frama-C and Why3 to ensure that it satisfies the given formal specification. The tool can also improve existing code by generating code snippets that satisfy the given formal specification.
OPENAI_API_KEY=... GROQ_API_KEY=...
pip install -r requirements.txtRun:
python main.py functionThe tool expects three separate files:
VeCoGen combines these specifications in the prompt. The -spectype flag controls which specifications are used:
generate_code_folder processes each subfolder and generates code based on all three inputs.
Make sure you are in the python_modules directory:
python3 main.py generate_code_folder \
-d ../paper_problems/ \
-ieg 2 \
-iter 2 \
-temp 1 \
-wpt 5 \
-o ../output/gpt-4o \
--output-file generated_code.c \
-fsf formal-specification.h \
-nl natural-language-specification.h \
-sig function-signature.h \
-pt one-shot \
-spectype both \
-provider openai \
-model gpt-4oThis generates code for all problems in a folder.
docker pull merlijnsevenhuijsen/vecogenOPENAI_API_KEY=XXX GROQ_API_KEY=XXX
docker run --env-file .env -it merlijnsevenhuijsen/vecogencd python_modulespython3 main.py generate_code_folder \
-d ../paper_problems/ \
-ieg 2 \
-iter 2 \
-temp 1 \
-wpt 5 \
-o ../output/gpt-4o \
--output-file generated_code.c \
-fsf formal-specification.h \
-nl natural-language-specification.h \
-sig function-signature.h \
-pt one-shot \
-spectype both \
-provider openai \
-model gpt-4opip install -r requirements.txtCreate .env:
OPENAI_API_KEY=XXX GROQ_API_KEY=XXX
Run:
cd python_modulespython3 main.py generate_code_folder \
-d ../paper_problems/ \
-ieg 2 \
-iter 2 \
-temp 1 \
-wpt 5 \
-o ../output/gpt-4o \
--output-file generated_code.c \
-fsf formal-specification.h \
-nl natural-language-specification.h \
-sig function-signature.h \
-pt one-shot \
-spectype both \
-provider openai \
-model gpt-4opython3 main.py generate_code_folder \
-d ../paper_problems/ \
-ieg 10 \
-iter 10 \
-temp 1 \
-wpt 5 \
-o ../output/llama3.1-8b-10-10-1-one-shot-both \
--output-file generated_code.c \
-fsf formal-specification.h \
-nl natural-language-specification.h \
-sig function-signature.h \
-pt one-shot \
-spectype both \
-rank proof-obligations \
-provider llama \
-model llama3.1-8bpython3 main.py generate_code_folder \
-d ../journal_problems/ \
-samples 1 \
-iter 1 \
-temp 1 \
-wpt 10 \
-o ../output/test-gpt-5-nano \
-of generated-code.c \
-fsf formal_specification.h \
-nl natural_language_specification.h \
-pt zero-shot \
-spectype both \
-rank test-cases \
-provider openai \
-model gpt-5-nano \
-wpm real \
-sig function_signature.c \
-tc solution_test.c \
-extra extras.c| Back | FazBrowse Home | New Git URL |