This preview shows page 1-2-3-4-5-6-7-49-50-51-52-53-54-55-98-99-100-101-102-103-104 out of 104 pages.
Final Report Polynomial Manipulation Language (PML) COMS 4115 Programming Languages and Translators Melinda Agyekum Shezan Baig Hari Kurup Subadhra Sridharan December 18, 2003Contents 1. An Introduction to PML 1.1 Background ............................................................................5 1.2 Language Features ..................................................................7 1.3 Language Implementations......................................................8 1.4 PML Scope and Limitation......................................................9 2. Tutorial 2.1 A Simple PML Program ....................................................... 10 2.2 Compiling and Running PML................................................ 10 2.3 A More Complex Problem.................................................... 12 3. Language Reference Manual 3.1 Lexical Conventions.............................................................. 12 3.1.1 Comments .................................................................... 12 3.1.2 Identifiers (Names) ....................................................... 13 3.1.3 Keywords..................................................................... 13 3.1.4 Type Specifiers............................................................. 13 3.1.4.1 int........................................................................ 13 3.1.4.2 float.....................................................................13 3.1.4.3 term..................................................................... 13 3.1.4.4 poly..................................................................... 14 3.1.4.5 polyeq.................................................................. 14 3.1.4.6 termarray............................................................. 14 3.1.4.7 chararry............................................................... 14 3.1.4.8 string literals........................................................ 14 3.2 Conversions.......................................................................... 14 3.3 Expressions .......................................................................... 15 3.3.1 Identifiers ..................................................................... 15 3.3.2 expression..................................................................... 15 3.3.3 Operators ..................................................................... 15 3.3.3.1 Multiplicative....................................................... 15 3.3.3.1.1 expr*expr .....................................................15 3.3.3.1.2 expr/expr...................................................... 16 3.3.3.2 Additive............................................................... 16 3.3.3.2.1 expr+expr..................................................... 16 3.3.3.2.2 expr-expr...................................................... 17 3.3.3.3 Relational............................................................. 19 3.3.3.3.1 Equality........................................................ 19 3.3.3.4 Power................................................................. 19 3.4 Declarations .......................................................................... 19 3.5 Statements............................................................................. 20 3.5.1 Compound Statement ................................................... 20 3.5.2 Conditional Statement................................................... 21 3.5.3 Loop Statement............................................................ 21 3.5.4 Break Statement........................................................... 213.5.5 Return Statement.......................................................... 21 3.5.6 Print Statement............................................................. 21 3.6 External Definition................................................................... 22 3.7 Scope Rules............................................................................. 22 3.7.1 Global Scope.................................................................. 22 3.7.2 Local Scope.................................................................... 23 3.7.3 Relationship Between Global and Local Scope ................ 26 3.8 NameSpace Rules.................................................................... 27 3.9 Entry Point.............................................................................. 27 3.10 Semantics For Variable Initiation ........................................... 27 3.10.1 Local Variables ............................................................. 28 3.10.2 Global Variables............................................................ 28 4. Project Plan 4.1 Project Process......................................................................... 31 4.1.1 Planning and Specification ................................................ 31 4.1.2 Development and Testing ................................................. 31 4.2 Team Responsibilities ............................................................... 31 4.3 Programming style (Coding Conventions).................................31 4.3.1 ANTLR Conventions........................................................ 31 4.3.2 JAVA Conventions........................................................... 32 4.4 Project Timeline ....................................................................... 32 4.5 Software Development Environment......................................... 33 4.6 Project Log .............................................................................. 33 5. Architecture & Design 5.1 Compiler Overview.................................................................... 33 5.2 Lexer......................................................................................... 34 5.3 Parser........................................................................................ 35 5.4 Walker and Executor................................................................. 35 5.4.1 class PMLRuntimeEnvironment …………………………...36 5.4.2 class
View Full Document