Parsing questions

Rasmus Anthin <>
6 Jan 2000 16:46:24 -0500

          From comp.compilers

Related articles
Parsing questions (Rasmus Anthin) (2000-01-06)
Parsing Questions (Stefan Ewing) (2002-06-13)
Re: Parsing Questions (Michael J. Fromberger) (2002-06-14)
Re: Parsing Questions (Ian Wild) (2002-06-14)
Re: Parsing Questions (Joachim Durchholz) (2002-06-14)
Re: Parsing Questions (Richard C Bilson) (2002-06-14)
Re: Parsing Questions (VBDis) (2002-06-14)
[2 later articles]
| List of all articles for this month |

From: Rasmus Anthin <>
Newsgroups: comp.compilers
Followup-To: poster
Date: 6 Jan 2000 16:46:24 -0500
Organization: Chalmers University of Technology
Keywords: parse, question

My token list and node-class looks like this:
typedef char *chr; //"Unlimited" strings

typedef struct{
      char token[toklen]; //toklen=30 or something. Ugly isn't it?
      int row;

toktyp t[1000]; //This is very ugly I know.

class Node{
      chr data;
      int code;
      Node *left,*right;
      Node(Node *l=0, Node *r=0, chr d=0, int cd=0) :
            left(l), right(r), data(d), code(cd) {}


I have begun writing the parser as something like this:


Node *parse(Node *root,int nr){
      case '+' :
            root->right=new Node(root->right,nr+2) // is this right??
....and so forth...

I don't know if I have got this right. However i would like some further
help on how to implement the parser for the binary tree-class???
Or should I use Recursive Descent or LALR or LL0 or LL1 or LR0 or LR1 ????
If so, how do I implement these????

Please help me!!!


B. Rasmus Anthin

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.