Skip to content

temple-fed/LAD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LAD : A simple data storage solution in C (MIT)

What is LAD?

LAD (List Aligned Data) is a lightweight data storage format with a simple grammar. It is easy to implement in any language and it can be very efficient and fast. It uses a semi-flat structure by design.

What are some key features?

  • Bring statements (granular include/import-like statements).
  • Namespaces for organization.
  • Excellent parse-time errors and warnings.
  • Advanced parse-time hooks via the Modular Meta Analysis system.
  • An explicit 'use default' keyword, none, instead of 'null'.
  • Useful string and integer notation interpolation.
  • Comments!
  • Super simple API.

Who is this for?

  • Anyone who wants a lightweight and simple solution to their data storage needs.
  • Anyone who wants to try implementing a simple language specification.

Basic high-level API showcase.

#include <LAD.h>
#include <stdio.h>

int main(void){
    LAD_ERROR_TYPE Error;
    LAD_Handle *Handle = ladNewHandle();

    Error = ladParseFile(Handle, "my_file.lad", LAD_PARSER_DEFAULT_FLAGS);

    //Only a heap error can stop LAD.
    if (Error == LAD_ERROR_MEM_FAIL){
        ladFreeHandle(Handle);
        return 1;
    }

    lad_byte *String = ladHandleFetchString(Handle, NULL, "my_global", "some default");
    puts(String);

    ladFreeHandle(Handle);
    return 0;
}

Important project files

  • The project comes pre-built (Win64) in the Bin/ folder.
    • The whole project source is divided between LAD.h and LAD.c.
    • It can be built from the Build/ folder just by running make.
  • Documentation on both the language spec and API are found in Documentation/.
  • Examples are found in Examples/

Samples:

Simple config example

#lad_version : 1

my_global : none //Use the default.

bring 'my_defaults.lad'

namespace MyNamespace
my_name_var : 'im accessible from MyNamespace'

Example shader file

#lad_version : 1
#shader_type : 'glsl' //Example hook for a rendering engine's shader config.

namespace Shaders
fragment : 'shader.frg'
vertex   : 'shader.vtx'

namespace Textures
/*...*/

String and integer notation

#lad_version : 1

//Variable shadowing and interpolations.
my_int : 0xbaadf00d //Hexadecimal.
my_int : 0c0127     //Octal.
my_int : 0b1101     //Binary.
my_int : 12345      //Decimal.

//Supports even uncommon characters like the bell or backaspace.
my_string : "interpola\ted"
my_string : 'not interpolated' //Single quotes -> no interpolation.

Feel free to contribute to the LAD project.

License : MIT | Current Version : 1

About

(C Library) Simple Lightweight Data Storage

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published