ELTN in C (Work in Progress)

Frank Mitchell

Posted: 2023-04-12
Last Modified: 2023-07-25
Word Count: 144
Tags: c-programming lua programming python ruby

Table of Contents

This project will create a C library to parse and emit ELTN text. It will then provide wrappers for various languages including Lua, Python, and Ruby.

Design

Reading

TODO

typedef const unsigned char* (*Eltn_Reader)(void* rdata, size_t *sptr);

TODO

Parsing

The core parser essentially ports ELTNPP to C:

FILE* fp;
Eltn_Parser* epp;
/* try { */
Eltn_Parser_new(&epp, File_Reader, fp);
while (Eltn_Parser_has_next(epp)) {
    Eltn_Parser_next(epp);
    switch (Eltn_Parser_event(epp)) {
        /* etc. ... */
    }
}
/* finally { */
fclose(fp);
Eltn_Parser_del(*epp);
/* } */

Eltn_Parser_event will signal a read error in addition to parse errors, but the API is otherwise remarkably similar.

Building

TODO

Wrappers

Wrappers will use native I/O to construct a tree of native associative arrays.

Lua

The parser will create a tree of tables.

TODO

Python

The parser will create a tree of dictionaries.

TODO

Ruby

The parser will create a tree of Hashes.

TODO