libsapling  0.8.0
Typedefs | Functions
production.h File Reference

Production implementation. More...

#include "libsapling/dm/graph.h"

Go to the source code of this file.

Typedefs

typedef struct production * production_t
 

Functions

production_t new_production (int id, node_t *body)
 Allocates a new production on the heap. More...
 
void delete_production (production_t ref)
 Frees the memory previously allocated on the heap for a production with new_production.
 
int production__id (production_t ref)
 Returns the productions's grammar symbol identifier. More...
 
int production__len (production_t ref)
 Returns the length of the production's body. More...
 
int * production__get (production_t ref, int pos)
 Returns the grammar symbol at the specified position in the production's body. More...
 
void production__print (FILE *stream, const void *data)
 Prints a production through the specified stream. More...
 

Detailed Description

Production implementation.

Function Documentation

◆ new_production()

production_t new_production ( int  id,
node_t *  body 
)

Allocates a new production on the heap.

Parameters
idThe production's gramar symbol identifier.
bodyThe production's body.
Returns
pointer to the allocated production.

◆ production__get()

int* production__get ( production_t  ref,
int  pos 
)

Returns the grammar symbol at the specified position in the production's body.

Returns
the grammar symbol at the specified position in the production's body.

◆ production__id()

int production__id ( production_t  ref)

Returns the productions's grammar symbol identifier.

Returns
the terminal's grammar symbol identifier.

◆ production__len()

int production__len ( production_t  ref)

Returns the length of the production's body.

Returns
the length of the production's body.

◆ production__print()

void production__print ( FILE *  stream,
const void *  data 
)

Prints a production through the specified stream.

Parameters
dataA production_t object