C++ :: Running A SLR Parser Program?
Apr 27, 2012
I need to run a program that makes a SLR Parser Table.
Here is the code :
Code to find first and follow:
saved as SLR.h
#include<stdio.h>
#include<ctype.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
#include<iostream.h>
#define epsilon '^'
since I didn't know how to type epsilon symbol temporarily I am using ^
char prod[20][20],T[20],NT[20],c[10][10],foll[10][10],fir[10][10];
int tt,tnt,tp,a;
int follow[20][20],first[20][20];
void first_of(char);
int count(int j);
void rhs(int j);
[code]....
View 3 Replies
ADVERTISEMENT
Apr 9, 2013
I wrote a small program that handles configuration files. I was wondering if this code is considered "good?" I am also wondering if there are ways to optimize it.
class configFile {
std::vector<std::string> variables;
std::vector<std::string> values;
public:
/* declare the constructor function */
configFile(std::string loc) {
[Code] ....
View 3 Replies
View Related
Jul 23, 2014
after you have compiled a program can you run it without an IDE?
View 17 Replies
View Related
Jun 17, 2014
I have a question, how can I check if a program is running using c++? For example
if (notepad.exe is running) {
.... ..... ....
View 3 Replies
View Related
Apr 20, 2013
Code:
#include<stdio.h>
#include<process.h>
struct que
[Code].....
View 1 Replies
View Related
Nov 20, 2014
#include <iostream>
using namespace std;
int main() {
[Code].....
View 2 Replies
View Related
Apr 22, 2013
i created a windows service that will run another program. but the program i want to run has a gui and i don't want the gui to be visible, i just want the program to run in the background.
But i have to do it without editing the gui program
here's my code:
Code:
TCHAR* path = L"C:Myfile est.exe";
STARTUPINFO info = {0};
PROCESS_INFORMATION processInfo;
ZeroMemory( &info, sizeof(info) );
info.cb = sizeof(info);
[code]....
i tested this code with notepad and it runs notepad in the background without displaying the window but when i try run my program it doesn't work. i don't know why its works for one program and not the other..
View 14 Replies
View Related
Feb 4, 2015
I'm working the 4th problem in chapter 14 of the Jumping into C++ book. In the book, he gives an example program for dynamically resizing an array while the program is running. It works fine for integer types but i need to do the same with a string type array. Right now my program is crashing because the string array is not resizing itself. Here's the part of the code im trying to figure out. The part for the int array has been ignored using // since it works fine and I'm trying to figure out whats wrong with the string array.
Code:
#include <iostream>
#include <string>
//Write a program that lets users keep track of the last time they talked to each of their friends.
//Users should be able to add new friends (as many as they want!) and store the number of days ago
[Code]......
View 8 Replies
View Related
Dec 1, 2013
So i compile fine, but when i run my program, after the printf it just segfaults (core dumped)...
Code:
#include<stdio.h>#include<string.h>
#include<stdlib.h>
void main() {
unsigned int j=0, max=9;
char num[100] , str1[100], str2[max];
FILE *fp;
[Code] .....
View 4 Replies
View Related
Mar 6, 2015
The assignment is to write a program that statistically computes similarity of C syntax with another program; a same and a different. The one used here is in C language, it's called Battleship.cpp. The program must open a file and read line by line for keywords and then produce statistics. The reason my code is not running is the fopen function is failing and it goes to return -1. I am using MS Visual Studio 2013 and there are no compiler errors after turning off deprecation. I do see, however, this error UMEngx86.dll'. Cannot find or open the PDB file. The file being opened is in my source folder.
Code:
1
2
3
4
5
[code]....
View 4 Replies
View Related
Feb 1, 2013
I use turbo c++ 3.0
How to set the background color using the function setbkcolor() in graphics.h
will i need to run the exe file in full screen if i use this function?
View 4 Replies
View Related
Mar 4, 2014
The program is not showing my full menu just the 0 Exit and the last line of text. This is the full main source file (not implementation file or header file).
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
#include <vector>
using namespace std;
struct menuItem{
string itemDesc;
double price;
int menuType;
[Code] .....
View 3 Replies
View Related
Dec 13, 2013
I have a class which dynamically allocates memory for three data arrays, and as such in the destructor I told it to delete those data arrays.
However, when I've created a new class, and inherited the previous class - it will always crash AFTER running the program, unless I don't have the previous destructor present.
View 3 Replies
View Related
Apr 3, 2015
For my c++ we're suppose to write a program that prints out a check. It's suppose to translate the numeric value of the dollars to worded strings.
Header File:
#ifndef CHECKWRITING_H
#define CHECKWRITING_H
#include <string>
[Code]....
View 1 Replies
View Related
Mar 27, 2014
I keep getting the same error messages every time on Visual Studio. I don't know where the error is originating. Basically I'm trying to convert an infix expression (A+B-C) to a postfix expression (AB+C-) using stacks.
#include <iostream>
#include <fstream>
#include <string>
#include <stack>
#include "Expression.h"
#include "stackType.h"
using namespace std;
int main() {
string fileName;
string infixExpression, postfixExpression;
[Code] .....
View 2 Replies
View Related
May 2, 2013
No I definitely used Visual Studio Command Prompt
c:Program FilesMicrosoft Visual Studio 9.0VC
un_process_from_service>make.bat
View 7 Replies
View Related
Dec 11, 2013
I have written a program which uses a pid to check if the process is currently running and return a value based on the system call result.But the program core dumps
Code:
#include <stdio.h>
#include <string.h
int main( argc, argv )
int argc;
char * argv[];
{
int p_pid = 99;
char buff[1000];
}
[code]....
What is the mistake in this code and is it portable in both unix/linux , is the method secure (grepping for program name )?
View 6 Replies
View Related
Mar 11, 2013
The code below is for reversing every k nodes of the linked list. While running the Program it crashes.
Code:
#include<stdio.h>
#include<stdlib.h>
struct node {
int info;
struct node *next;
[Code] ....
View 1 Replies
View Related
Oct 5, 2013
I am writing a simple file parser for use in another project (for config file). The trickiest thing seems to be skipping unwanted characters (comments, spaces). It works partly, but after the second line of an inputed file processes only the first three characters.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define TEXT_FILE "data.txt"
[code]....
NOTE: Currently I am just trying to process and remove unwanted data, the actual processing of extracted data should be much simpler.
View 6 Replies
View Related
Mar 22, 2014
I am implementing a recursive descent parser that recognizes strings in the language below.
The grammar:
A -> I = E | E
E -> T + E | T - E | T
T -> F * T | F / T | F
F -> P ^ F | P
P -> I | L | UI | UL | (A)
U -> + | - | !
I -> C | CI
C -> a | b | ... | y | z
L -> D | DL
D -> 0 | 1 | ... | 8 | 9
My input file has the following two strings:
a=a+b-c*d
a=a**b++c
The desired output:
String read from file: a=a+b-c*d
The string "a=a+b-c*d" is in the language.
String read from file: a=a**b++c
The string "a=a**b++c" is not in the language.
[Code].....
When I test the code without reading the text file and just write a string in the source code, it appears to parse fine. I believe my main problem is in the int main function and how i am reading the text file and outputting it. I was able to write the same program fine in Java.
View 3 Replies
View Related
May 5, 2014
How can we implement an expression parser in C++.
View 3 Replies
View Related
Oct 22, 2014
I am trying to write a program that reads in an XML file, parses it and prints out information about each tag. I am getting the following errors when trying to build the program:
Parser.cpp:24:1: error: 'Parser' does not name a type
Parser::getXMLData() {
^
Parser.cpp:120:1: error: 'Parser' does not name a type
Parser:rocessXMLData(
[Code] ....
Here is my code for the 5 files.
[ATTACH]main.cpp
[/ATTACH][ATTACH]Parser.h
[/ATTACH][ATTACH]Parser.cpp
[/ATTACH][ATTACH]Element.h
[/ATTACH][ATTACH]Element.cpp[/ATTACH]
View 5 Replies
View Related
Jan 4, 2015
I would like to make a sort of text parser, in which one enters a string, and it is broken by the whitespaces into chunks, and those chunks compared to different "dictionaries" where the words are assigned a value. For example if the operator enters "take lamp" it would separate "take" and "lamp" and then produce preassigned values for each of these words.
View 3 Replies
View Related
Feb 13, 2013
I've knocked up a rough C parser for the purpose of colourizing code into XHTML/CSS, which makes me feel fancy. However, it doesn't quite handle comments properly. I can't quite work out how to deal with the slashes. Plus I'm sure there are other places that it slips up that don't feature in my simple tests, so here you go:-
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define FLAG_OUTPUT1
#define FLAG_EVEN2
#define NUMKEYWORDS32
}
[code]....
View 6 Replies
View Related
Dec 23, 2014
For some reason when i put cout<<endl i'm getting segmentation faults in my Parser code. It's really weird some inputs of strings using cout is already faulting. However sometimes printf doesn't fault, but sometimes it will, it seems really unstable.
The court can basically be anywhere in the Parse(string) function, i have a cout at line 254 which faults.
Here is the code:
#include "Parser.h"
#include <stdio.h>
#include <iostream>
using namespace std;
Parser::Parser() {
[Code] ....
View 3 Replies
View Related
Jan 18, 2013
So. I have a CSV Parser that I built. It works very well. The way it currently works is that I have the parser in a header file "CSV_Parser". So my .cpp code would look like this:
#include <iostream>
#include <eigen3/Eigen/Dense>
#include "CSV_Parser.h"
using namespace std;
using Eigen;
[Code] ....
This all works great. I am running Eclipse in Linux (Xubuntu to be precise). In the header file the .csv is opened as follows:
ifstream infile;
infile.open("/home/karrotman/Desktop/Matrix.csv");
What I would like is for the user to be able to change the file that the parser is opening through the main .cpp file. In other words, is there a way to create some variable, say "FileName" and do the following:
CSV firstMat;
string MatrixA = "/home/karrotman/Desktop/Matrix1.csv";
firstMat.extract(MatrixA);
CSV secondMat;
string MatrixB = "/home/karrotman/Desktop/Matrix2.csv";
secondMat.extract(MatrixB);
And then the .h would now say:
void extract(string FileName)
...
ifstream infile;
infile.open(FileName);
Obviously this does not work. Ultimately the goal is for me to open 4 .csvs at one time so I can do numerical operations on them.
View 2 Replies
View Related