Welcome to the Noodle C99 Parser project! This repository contains a C99 parser designed for the Noodle data language. Noodle is a lightweight language for data representation. This parser lets you seamlessly integrate Noodle data structures into C applications.
- Parse Noodle data files into C99 data structures.
- Intuitive API for navigating and manipulating parsed Noodle data.
- Lightweight and minimal dependencies.
- Clone this repository:
git clone https://github.com/cadenmiller/noodlec.git
- Navigate to the project directory:
cd noodlec
- Build the parser library using CMake.
- Link with your C project.
- Include
"noodle.h"
in your code. - Initialize by creating a root
Noodle_t
using noodleParse(). - Work with the parsed data using the functions noodleFrom() and noodleAt().
- Free resources with
noodleFree()
.
#include <stdio.h>
#include "noodle.h"
int main() {
NoodleGroup_t* settings = noodleParseFromFile("settings.noodle");
if (!parser) return EXIT_FAILURE;
bool valid = false;
float volume = noodleFloatFrom(settings, "volume", &valid);
int vulkanDeviceId = noodleIntFrom(settings, "vulkanDeviceId", &valid);
if (!valid) return EXIT_FAILURE;
// And it's just that easy, use the parsed data here!
// ...
noodleFree(settings);
return 0;
}
Feel free to contribute and stick to continuing the current code styling.
This project is licensed under the MIT License.