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

Processes the semantics phase. Parses the grammar and translates the AST to opcodes. The compiler, so to speak. More...

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

Go to the source code of this file.

Macros

#define BUF_SIZE   256
 

Functions

void vApiOpcodes (void *vpCtx)
 Parse the SABNF grammar and translate its AST into opcodes for all the rules. More...
 
aint uiFindRule (semantic_rule *spRules, aint uiRuleCount, const char *cpName, aint uiNameLength)
 Find the index of the named rule in the rule list. More...
 
aint uiFindUdt (semantic_udt *spUdts, aint uiUdtCount, const char *cpName, aint uiNameLength)
 

Detailed Description

Processes the semantics phase. Parses the grammar and translates the AST to opcodes. The compiler, so to speak.

Definition in file semantics.c.

Macro Definition Documentation

◆ BUF_SIZE

#define BUF_SIZE   256

Definition at line 51 of file semantics.c.

Function Documentation

◆ uiFindRule()

aint uiFindRule ( semantic_rule spRules,
aint  uiRuleCount,
const char *  cpName,
aint  uiNameLength 
)

Find the index of the named rule in the rule list.

Does a simple linear search.

Parameters
[in]spRules- the array of rules
[in]uiRuleCount- the number of rules
[in]cpName- pointer to the name to look for (not a null-terminated string)
[in]uiNameLength- the number of characters in the name
Returns
the index of the rule in the rule list if the name is found, APG_UNDEFINED otherwise

Definition at line 160 of file semantics.c.

◆ uiFindUdt()

aint uiFindUdt ( semantic_udt spUdts,
aint  uiUdtCount,
const char *  cpName,
aint  uiNameLength 
)

Definition at line 172 of file semantics.c.

◆ vApiOpcodes()

void vApiOpcodes ( void *  vpCtx)

Parse the SABNF grammar and translate its AST into opcodes for all the rules.

Parameters
vpCtx- Pointer to an API context previously returned from vpApiCtor().

Definition at line 64 of file semantics.c.

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