![]() |
| | #1 |
| Registered User Join Date: Oct 2002
Posts: 69
| draw tree graph of yacc parsing The parsing is done and working, and now I just need to somehow display the pathing it takes while tracing through the parsing process. Can anybody give me a starting point for this? I assume recursion is used throughout the process (since it's supposed to be a recursive descent parser), but I don't see where the recursion happens, or where the functions are called from. I'll link the rar file of all the code, and hopefully someone can help! http://www.talz13.com/downloads/other/project.rar I'd really like to be able to draw something like the samples on this page, but that is all about ruby, and I don't know how the inner workings of the yacc process go. TIA, talz13 |
| talz13 is offline | |
| | #2 |
| Registered User Join Date: Oct 2002
Posts: 69
| Does anybody know how to turn out a kind of graph like this from a yacc parsing? Not from the base grammar, but from the path that the parsing follows? Code: 12
.----' `----.
20 15
.-' `-. .-' `-.
29 23 17 22
/ \ / \ /
35 40 26 51 19
|
| talz13 is offline | |
| | #3 |
| and the hat of vanishing Join Date: Aug 2001 Location: The edge of the known universe
Posts: 21,214
| > I assume recursion is used throughout the process (since it's supposed to be a recursive descent parser) So pick a point in your parse code which you think is recursively called, and put a breakpoint there in your debugger. Then see if it is called recursively. Unless you call back into the yacc parse function from your yacc rules, then the answer is probably no recursion is used. My guess is you need to track the recursion via your yacc input files. Say for example when you see an opening brace, you increment a count, and when you see a closing brace, you decrement the count. I was also ignoring you because I've no way to decode your compression format. If you're going to just dump your entire project for someone else to sort out (not recommended), at least pick a format everyone should be able to decode.
__________________ If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut. Up to 8Mb PlusNet broadband from only £5.99 a month! |
| Salem is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Interpreter.c | moussa | C Programming | 4 | 05-28-2008 05:59 PM |
| Binary Search Trees Part III | Prelude | A Brief History of Cprogramming.com | 16 | 10-02-2004 03:00 PM |
| Request for comments | Prelude | A Brief History of Cprogramming.com | 15 | 01-02-2004 10:33 AM |
| Binary Tree Search | C++Newbie | C++ Programming | 5 | 03-22-2002 12:38 PM |
| BST/Red and Black Tree | ghettoman | C++ Programming | 0 | 10-24-2001 10:45 PM |