Version 7.0
Copyright © 2021 Lowell D. Thomas
APG
… an ABNF Parser Generator
Data Structures | Functions
main.c File Reference

Driver for the AST example. More...

#include "../../api/api.h"
Include dependency graph for main.c:

Go to the source code of this file.

Data Structures

struct  my_data
 

Functions

int main (int argc, char **argv)
 Main function for the basic application. More...
 

Detailed Description

Driver for the AST example.

The Abstract Syntax Tree, or AST, is a subset of the concrete syntax tree. That is, a partial representation of the full syntax of the parsed input string. As such, the AST has three features of interest here.

While call back functions from the rule name node operations during the actual parsing traversal of the full syntax tree can be useful and often complete, there is one serious pitfall that the application needs to be aware of and able to handle that is not present when traversing or translating from the AST. Namely, successfully matched rule nodes in branches that ultimately fail. If attempting to translate directly from the syntax tree, precautions need to be taken to recognize this situation and delete any translated information from failed branches.

Many real-life examples no doubt exist, but specifically see the "domainlabel" rule in the Session Initiation Protocol (SIP) example.

Here, however, only an extremely simple grammar will be used to illustrate the problem.

The compiled example will execute the following cases. Run the application with no arguments for application usage.

Definition in file main.c.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Main function for the basic application.

This example has several cases. Run the main program with no arguments to see a help screen with usage and a list of the cases with a brief description of each.

Parameters
argcThe number of command line arguments.
argvAn array of pointers to the command line arguments.
Returns
The application's exit code.

Definition at line 314 of file main.c.

APG Version 7.0 is licensed under the 2-Clause BSD License,
an Open Source Initiative Approved License.