Products: Visual Parse++: Tutorials: Topics: Other Support:
Visual_Parse++     Visual_Parse++_Features GUI Tutor 1 Reducing a Rule Parsing Technology
DataStruct Why Visual Parse++? GUI Tutor 2 Expression List Stack Documentation
Meta-S Download Trial C++ Tutor 1 Flexible File Format Further Reading
Ordering Accolades Java Tutor 1 Grammar Idioms Consulting Services
Support Our Customers
  Back to home page  Click here for our free informative book "Parsing with Visual Parse++"  
 

Support: Tutorials - Visual Parse++ GUI Tutor 2

"The industry standard visual parsing tool."

GUI Tutor 1
GUI Tutor 2
C++ Tutor 1
JBuilder Java Tutor1
 
   For a 15 day free trial click here To order now click here!  
 

This tutorial is a little more advanced than the first tutorial. It will show you how to:

 

Set breakpoints

Run to a breakpoint

Use the lookahead feature

Animated while testing

Test multiple files at once

 

  1. Open the XML workspace created in GUI Tutor 1. To do this, you can either start Visual Parse++ and use the File/Open Workspace... menu selection, or you can navigate to our Samples\XML directory with the Windows Explorer and double click on XML.ypw. This will automatically start Visual Parse++ and open the workspace. The XML.ycc rule file is opened in an edit window.

  2. Scroll down in the XML.ycc rule file to the <!DOCTYPE expression, line 115.

  3. Select Debug/Toggle Breakpoint (or press F4, or click the Toggle Breakpoint toolbar button, that looks like a hand ). A red circle is drawn in the margin on this line to indicate the breakpoint is set.

  4. Select Debug/Open Test File/Character (or click the Start toolbar button ). An open file dialog is displayed. Open the file 001.xml in our Samples/XML directory.

  5. Select Debug/Run (or press F5, or click the Run toolbar button).

  6. The run will stop when the <!DOCTYPE token is recognized, because that's where we put the breakpoint.

  7. We'll sidestep a little here to show you how to use a frequently used feature. If you want to restart the testing of the same file, you can easily do it with by selecting Debug/Restart, or pressing Ctrl-F5, or by clicking the Restart toolbar button . Try it now.

  8. Press F5 (Run) again to get us back where we were.

  9. Scroll down to line 343. It's the DoctypeDecl production. Set a breakpoint there by putting the cursor on that line and using either Debug/Toggle Breakpoint, F4, or by clicking the Toggle Breakpoint toolbar button .

  10. Press F5 (Run ) again.

  11. This time the run will stop when the DoctypeDecl production is about to get reduced.

  12. Press F10 or click the Step button on the toolbar to finish the reduce.

  13. Select Debug/Show Lookaheads. This is a useful feature to use when debugging. When the lexer is operating, it will show you the matches (as usual), and, the current lookahead tokens are also highlighted for you. This shows you the set of tokens that are valid in the current state. Sometimes it can be quite useful to have Show Lookaheads on when you are debugging.

  14. Step (Press F10 or click the Step button on the toolbar) until the state changes to Lexing (4 more times).

  15. As usual, the matches are all highlighted, but this time the lookahead tokens are also highlighted. Yellow indicates that it is a lookahead token, and green indicates that it is a lookahead token and a current match.

  16. Step (F10) again until the < token is recognized. The lookahead tokens are also highlighted in yellow.

  17. We'll just animate the rest of this test run by selecting Debug/Animate . This will use a timer to step through the rest of the test data. You can set the timer increment by going to the Project/Settings... and selecting the Misc tab. It has an edit box to specify the delay.

  18. The debugger will stop when the state is Accept.

  19. Clear the breakpoints by selecting Debug/Remove All Breakpoints, or clicking the Remove All Breakpoints toolbar button .

  20. We'll now show how to test multiple test files at once. Select Debug/Run Directory. An open file dialog will get displayed. It should be in our Samples/XML directory. If it isn't, navigate to this directory. 

  21. Type in *.xml in the File name edit box and click Open.

  22. You'll probably hear 3 quick beeps as each of the three .xml files in this directory are tested. The files tested are also listed in the Message window toward the bottom of the screen. 

  23. This is how you run through multiple test files for backtesting. There is also a menu selection called Debug/Run Last Directory (Shift +F11) that you can use to run the last directory selected. You can try that now. Select Debug/Run Last Directory and you'll hear the 3 beeps again as each file is tested. One other option related to this is the Debug/Recurse Directories selection. If you enable this, all the child directories of the directory that you selected are also searched for matching files. 

That's the end of this tutorial. You may proceed to one of the tutorials on generating files and coding your application, such as C++ Coding Tutor 1.