Practice

Top  Previous  Next

How to begin with a new project? > Practice

 

1. Create a new project

 

In the file menu choose the item new project. At first the wizard for new projects appears.

 

2. Enter names

 

A project name and a name have to be entered on the first page of the wizard for the start rule. In most cases you should call both same: Book. If this name is entered for the project name to the field, then it appears also at once in the field for the start rule and the next step is shown in the left menu of the wizard: Project type.

 

3. Choose project type

 

You can go to the page for the project type either by selecting the button Next or by clicking on the menu item. There are four different choices for project types on this page. The last one: "New project from scratch" shall be chosen here. As soon as it is selected, the page is changed to the next one Finish automatically, where the chosen names are shown again.

 

4. Save raw project

 

As soon as the Finish button is pressed, a file selection dialog appears where the folder is selected in whom the project shall be saved.

 

5. Edit start rule: Book

 

When the project was saved, the wizard is closed automatically and you are on the main page of the Tetra IDE. The chosen name Book is already shown on the selection box for the start rule in the toolbar. It as well as it is already registered in the project options and it can be seen also in the syntax tree on the right side of the IDE. If it is selected there, then the tab page Productions opens and you see the definition of the book production: SKIP. With  SKIP every text is recognized. So the definition must be edited.

 

As suggested - in the theoretical part under item 3 - the definition text of the Book production is replaced now by:

 

SKIP? Chapter+

 

At first the expression Chapter is represented in a normal font. If the Chapter production were already defined, it would be shown in a brown boldface printing. This definition shall be made now.

 

6. Insert production: Chapter

 

At first a new rule is created with the plus button. Write for its the name Chapter, please. The definition text shall be

 

TITLE SKIP

 

After confirmation, the expression TITLE is represented in a normal font this time. If you go back to the Book production with the back button, you will see that Chapter is highlighted there meanwhile. Now TITLE has to be defined. The capitalization of the word shall express that it isn't a production but a token. However, such a capitalization isn't necessary.

 

7. Insert token: TITLE

 

Tokens have to be defined on the token tab page. The operation is analogous as on the production page here. With the plus button a new token is produced which gets the name TITLE.  A title might be defined by

 

\d\.[^\r\n]+

 

This expression can recognize headings, which begin with a digit and a dot, followed by an arbitrary sequence of characters up to the line ending. This isn't for certain a general syntactic definition for titles; it only serves as an example.

 

8. Compile project

 

The project is complete now and can be compiled. Click on the button Parse start rule in the main tool bar.. You can see the structures of the productions in the syntax tree now, too.

 

9. Save again

 

Please don't forget to save the project. You can refine the project now as suggested in the theoretical part.



This page belongs to the TextTransformer Documentation

Home  Content  German