-
Notifications
You must be signed in to change notification settings - Fork 0
/
item.h
23 lines (17 loc) · 865 Bytes
/
item.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/**
* This header file defines the structure and functions related to the Item class.
* An Item represents a production rule with a dot indicating the current position.
**/
#ifndef ITEM_H
#define ITEM_H
#define MAX_RULE_SIZE 100
typedef struct {
char lhs; // Left-hand side of production
char rhs[MAX_RULE_SIZE]; // Right-hand side of production
int dot; // Position of the dot in the production
int prod_number; // Production number
} Item;
void closure(Item *item[], int count); // Calculates closure of the given set of items
void gotos(int symbol); // Calculates the GOTO set for the given symbol
void print_state(int n); // Prints the state with its items
#endif