blob: bce8e7714090ba829d010ab84dab2f17b2281ecf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include<FlexLexer.h>
#include <string.h>
#include <stdlib.h>
#include <iostream.h>
#include <fstream.h>
#include "stack.h"
int main(int argc, char* argv[] )
{
const char * file_name = strdup(argv[1]);
ifstream input;
input.open(file_name, ios::in);
yyFlexLexer* parser = new yyFlexLexer(&input);
/* allocate initial stack */
stack = (Stack *) malloc(stack_size * sizeof(Stack));
if ( stack == NULL)
{
cerr << "texparser: not enough memory for stacks\n";
return 3;
}
while(parser->yylex() != 0);
return 0;
}
|