Whilst I shouldnt have posted the entire code up, I see no other option :(

#include <iostream> // cout << endl ...
#include <fstream> // for reading in the file ...
#include <string> // for comparing strings ...

using namespace std;

string  reserveWordTable [4]= {
	"if", "then" , "else", "function"};
	string  typeTable[3] =  {"int","char","string"};

char temp[100]; // Global array to hold line by line

char *  getsym();
void file_input(void);
void setArray(char * FI);

void func_e(char &sym);
void func_t(char &sym);
void func_S(char &sym);
void func_E(char &sym);
void func_T(char &sym);
void func_F(char &sym);

int main()
{
	//cout << temp[10];
		file_input();
	cout << "Contents of global array is : " << ::temp << endl;
	char  * a;
	a = getsym();
 func_S(a);


return 0;
}

//sorts out the temp array and returns tokens.
char *  getsym()
{
	string buffer ;
	string t;
    char ch;
    static int i = 0;
	int j = 0;

    cout << "\nGetting the token\n" << endl;
   
    ch = temp[i];

		if(isalpha(ch) )
		{
			while(isalpha(ch))
				{
				buffer += ch;
				i++;
				ch = temp[i];

				if(ch == ';')
				{
					buffer += ch;
					i++;
					t = "ID";
					t += buffer;
				//	return t;
				}
			
			}
			t = "ID";
			t += buffer;
			int lenght = t.length();

				char * array = new char[lenght];

				for(int i = 0 ; i < t.length() ; i++)
				{
					array[i] = t[i];
				}
				array[lenght] = '\0';
		return array;
		//	return t;

		}
/*	if(isdigit(ch)) 
	{
		while(isdigit(ch))
		{
			buffer[j] = ch;	
			i++;
			j++;
			ch = temp[i];

				if(ch == '.') // checks for decimal point numbers
				{
					cout << "its a decimal point" << endl;
					buffer[j++] = ch;
					i++;
					ch=temp[i];	
				}
				//detects floating point numbers
				if(ch == 'E' || ch == 'e')
				{		
					cout << "its a floating point number" << endl;
					buffer[j++] = ch;
					i++;
					ch=temp[i];
				}
		}
	}*/
				   
	if(ch == '+')

	{	char * array = new char[1];
		cout << "its a plus" << endl;
		t = '+';

			for(int j = 0 ; j < t.length() ; j++)
				{
					array[j] = t[j];
				}
array[i] = '\0';
		i++;
		return array;
	}

	if(ch == '=')
	{
		cout << "its a assigement operator" << endl;
		t = '=';
		i++;
	}
}

//Reads the file and puts the incomming char's into the temp array
void file_input(void)
{
    char ch;

    static int i = 0;
    ifstream infile;
    infile.open("new.txt"); // (a,b,c)
        if(infile.fail())
        {
            cout << "unable to locate file " << endl;
            exit(1); // error causes a problem
        }
        else
        {
            while((ch = infile.get() )!= EOF) // checks for EOF
            {
					
				if (ch == ' ' || ch == '\n') // strips the whitespaces and adds the chars into the temp buffer
                {}
				else
					{
					temp[i] = ch;
					i++;
					}
					
			}		
				
        }
 }
	
void func_e(char &sym)
{
	cout << "in funct_e, checking for + ->" << sym << endl;
	if(sym == '+')
	{
		sym=getsym();
		func_T(sym);
		func_e(sym);
	}

}
void func_t(char &sym)
{
    
	if(sym=='*')
	{
        cout << "in funct_t, checking for * ->" << sym << endl;
        sym=getsym();
		func_F(sym);
		func_t(sym);
	}
}
void func_S(char &sym)
{
	func_E(sym);
	if(sym!='$')
		cout << "error missing dollar"<<endl;
	else
		cout << "Parse sucesfful" << endl;
}
void func_E(char &sym)
{
	func_T(sym);
	func_e(sym);
}

void func_T(char &sym)
{
	func_F(sym);
	func_t(sym);
}
void func_F(char &sym)
{
	cout << "In funct_f, checking for id: = " << sym << endl;
	/*char id;
	for(int i = 0; i<3; i++)
	{
		if(sym==RW[i])
		{
			func_S(sym);
			cout << "error on the input stream" << endl;
		}
		else
		id = sym;
		
		cin.get();
	}*/
	if(sym=='a' || sym == 'b')
		sym=getsym();
	
	else
		if(sym=='(')
		{
			sym=getsym();
			func_E(sym);
			if(sym==')')
				sym=getsym();
			else
			{
				cout << "error missing brackets" <<endl;
				exit(1);
			}
		}
		else
		{
			cout << "error missing id" <<endl;
		exit(1);
		}

}

I get the follow errors at compile time:

--------------------Configuration: - Win32 Debug--------------------
Compiling...

(31) : error C2664: 'func_S' : cannot convert parameter 1 from 'char *' to 'char &'
A reference that is not to 'const' cannot be bound to a non-lvalue

(169) : error C2440: '=' : cannot convert from 'char *' to 'char'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast

(181) : error C2440: '=' : cannot convert from 'char *' to 'char'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast

(222) : error C2440: '=' : cannot convert from 'char *' to 'char'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast

(227) : error C2440: '=' : cannot convert from 'char *' to 'char'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast

(230) : error C2440: '=' : cannot convert from 'char *' to 'char'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Error executing cl.exe.

Copy of lexicalScanner.exe - 6 error(s), 0 warning(s)

Can anyone help? Please

You're trying to pass a memory address of a character to a function that, as declared, expects you to pass an individual character. Passing a character by reference is not the same thing as passing a pointer to a character.

This article has been dead for over six months. Start a new discussion instead.