// file: grammar_compiler.h
//
// definitions file for the grammar compiler
//

// make sure definitions are made only once
//
#ifndef __ISIP_GRAMMAR_COMPILER
#define __ISIP_GRAMMAR_COMPILER

// isip include files
//
#ifndef __ISIP_INTEGRAL
#include <integral.h>
#endif

// forward declaration of classes
//
#ifndef __ISIP_HASH_CELL
#include <hash_cell.h>
#endif

#ifndef __ISIP_HASH_TABLE
#include <hash_table.h>
#endif

#ifndef __ISIP_LATTICE
#include <lattice.h>
#endif

#ifndef __ISIP_LATTICE_NODE
#include <lattice_node.h>
#endif

#ifndef __ISIP_LINK_LIST
#include <link_list.h>
#endif

#ifndef __ISIP_LINK_NODE
#include <link_node.h>
#endif

#ifndef __ISIP_MEMORY_MANAGER
#include <memory_manager.h>
#endif

#ifndef __ISIP_WORD
#include <word.h>
#endif

#ifndef __ISIP_PARAM_FILE
#include <param_file.h>
#endif

// functions to decipher commandline
//
logical_1 read_cmdline_cc(int_4 argc, char_1** argv,
			  logical_1& probablistic_flag,
			  char_1* input_file, char_1* output_file);

// function to construct grammar network
//
logical_1 build_net_cc(char_1** symbols, int_4& index, Lattice_node* start,
		       Lattice_node* end, Lattice_node*& prev, 
		       Lattice*& lattice, int_4& num_nodes, int_4& num_arcs,
		       logical_1& allprob_flag);

Lattice_node* create_latnode_cc(char_1* word_name_a, int_4& num_nodes_a,
				Lattice*& lattice);

// function to read the grammar from file and parse it
//
logical_1 read_grammar_cc(char_1** symbols, int_4& size, char_1* file,
			  char_1*& buffer, int_4& buffer_size);

// function to pre-process the grammar
// probability detection and distribution of the sub-expression probabilities
logical_1 preprocessing_grammar_cc(char_1** symbols_a, int_4& size_a);

// end of file
//
#endif
