Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming Language Features Syntax Semantics. Syntax Diagram.

Similar presentations


Presentation on theme: "Programming Language Features Syntax Semantics. Syntax Diagram."— Presentation transcript:

1 Programming Language Features Syntax Semantics

2 Syntax Diagram

3

4

5

6

7

8

9

10

11 Drawing Gizmo Example // Example program with parameters that displays a T // The T is drawn by the method drawT public class Driver { private DrawingGizmo pencil; public void drawT() { //Draws a letter T //PRE: Assumes the current position of the pen is the // leftmost postion of the top of the T and the direction // of the pen is 0 degrees //POST: The method leaves the pen at the rightmost // position of the top of the T and the direction of the // pen is 0 degrees pencil.draw(); pencil.turnBy(90); pencil.moveBy(80);

12 Drawing Gizmo Example //Move the pen to the middle of the top of the T pencil.dontDraw(); pencil.turnBy(-180); pencil.moveBy(40); //Draw the vertical part of the T pencil.draw(); pencil.turnBy(-90); pencil.moveBy(120); //Move pen to the rightmost position of the top of the T //leave the direction of the pen at 0 degrees pencil.dontDraw(); pencil.turnBy(180); pencil.moveBy(120); pencil.turnBy(90); pencil.moveBy(40); pencil.turnBy(-90); }

13 Drawing Gizmo Example public Driver() { pencil = new DrawingGizmo(); //Move the pen to the left pencil.dontDraw(); pencil.turnBy(-90); pencil.moveBy(80); pencil.turnBy(90); drawT(); }


Download ppt "Programming Language Features Syntax Semantics. Syntax Diagram."

Similar presentations


Ads by Google