Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

8 Commits

Repository files navigation

Corn.zig

Implementation of the Corn configuration language in the Zig programming language.

Work in progress

This library is currently a work-in-progress and isn't fully ready to be used.

Installation

To the .dependencies section of your build.zig.zon file, add:

.corn= {
.url="https://github.com/corn-config/corn.zig/archive/refs/tags/v0.0.1.tar.gz",
.hash="corn-0.0.1-K8bW1DfuAABspuvfDhXCTSpINnoY27nKGfUe1hGoS9dn", }

then to your build.zig file you can add:

// This assumes you have a fairly-standard build configuration!constcorn=b.dependency("corn", .{
.target=target,
.optimize=optimize,
});
exe.addModule("corn", corn.module("corn"));

Usage

conststd=@import("std");
constcorn=@import("corn");
constassert=std.debug.assert;
consteql=std.mem.eql;
constCat=struct {
color: []constu8,
purring: bool,
};
fnmain() !void {
vargpa: std.heap.GeneralPurposeAllocator(.{}) =.init;
constallocator=gpa.allocator();
constinput="{ color = \"orange\" purring = true }";
constcat=trycorn.parseCorn(Cat, input, allocator, null);
assert(eql(u8, cat.color, "orange"));
assert(cat.purring);
} 

About

Corn parser implemented in Zig

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages