librdesc
Loading...
Searching...
No Matches
librdesc

librdesc is a portable parsing library written in standard C99. It provides the flexibility of a recursive descent parser with high degree of control in manual stack management.

Check out online documentation for building and public API details!

Quick Integration Guide

You can easily embed librdesc as a subproject and build dependency inside your own Makefiles by including the rdesc.mk.

This avoids the need for system-wide installation and builds the library alongside your project.

# Set the path to your librdesc source folder. (REQUIRED)
RDESC_DIR := vendor/rdesc
# Optionally configure the build variables
RDESC_MODE := debug
RDESC_FEATURES := stack dump_cst
# You may prefer installing librdesc using git
$(RDESC_DIR)/rdesc.mk:
git clone https://github.com/metwse/rdesc.git $(RDESC_DIR)
# Include the librdesc build system
include $(RDESC_DIR)/rdesc.mk
# ...
# Use the exported variables in your targets. $(RDESC) points to the static
# library path.
my_app: main.c $(RDESC)
$(CC) -I$(RDESC_INCLUDE_DIR) $< $(RDESC) -o $@

Configuration Variables

librdesc provides an include-based build which uses the following RDESC_* configuration variables to control the build process. When building directly from this repository's root makefile, you can drop the RDESC_ prefix (e.g., make MODE=debug).

Variable Description Default Valid Values
RDESC_MODE Determines the optimization level and instrumentation. release release, debug, test
RDESC_FEATURES Toggles modules linked into the library. stack stack, dump_bnf, dump_cst, full
RDESC_FLAGS Internal flags to configure library behavior. ASSERTIONS ASSERTIONS, full
RDESC_DIR Path to the root of the librdesc source repository. . (do not use default) rdesc path

rdesc.mk defines two target variables: RDESC, the static library target and RDESC_SO, the shared object version. You can set these before including the rdesc.mk file to output into desired location, but you can also use the default values that output to rdesc's internal build directory.

A variable named RDESC_INCLUDE_DIR is also defined to point to the folder containing the public headers.

Installation

make install PREFIX=/installation/path

This command copies headers into $PREFIX/include and librdesc.so/a into $PREFIX/lib. Leave PREFIX empty to install librdesc system-wide:

sudo make install

Also you can specify build configuration variables during installation, with or without RDESC_ prefix:

sudo make install FEATURES=full MODE=debug

Note: Test mode is not recommended for installation.

<tt>contribute -Wai-slop</tt>

no-ai-slop

Contributions are welcome! Please check our Code of Conduct before submitting pull requests.