e MDL Extended Motion Description Language EMDL vs
- Slides: 40
e. MDL Extended Motion Description Language
EMDL vs. MDL
MDL classic • Syntax: – line x 1, y 1, z 1, x 2, y 2, z 2 – Box x, y, z, dx, dy, dz – sphere x, y, z, r – move x, y, z [knob]
EMDL – Simple – Object Oriented – Robust – Supports Animation
Sample Syntax # delcare filename sample_syntax; # fucntion definiitions function ears { sphere 2=sphere 1; sphere 3=sphere 1; sphere 2. r=sphere 1. r/2; sphere 3. r=sphere 1. r/2; save; } function moveout { move sphere 3 <0, 50, 0>; sphere 2. y=sphere 2. y-50; save; } #more function definitions function moveback { sphere 3. y=sphere 3. y-50; sphere 2. y=sphere 2. y+50; save; } function movesideways { sphere 3. x=sphere 3. x-50; sphere 2. x=sphere 2. x+50; save; } function moveup { sphere 3. y=sphere 3. y-50; sphere 2. y=sphere 2. y-50; save; }
Sample Syntax (2) # main body set sphere 1 as sphere <150, 50>; set sphere 2 as sphere <100, 100>; set sphere 3 as sphere <100, 100>; hide sphere 2; hide sphere 3; save; funct ears; repeat <2>{funct moveout; }; repeat <2>{funct moveback; }; repeat <2>{funct movesideways; }; repeat <2>{funct moveup; };
Output
Output
Output
Output
Output
Output
Output
Output
Output
Output
Structure of e. MDL • • Filename Specification Function Declarations Variable Declarations Main Body
Filename Specification • Allows users to chose the filename for all MDL files that will be output • Must be the first line of the e. MDL script • Optional : if not included, then the program will default to outputting tmp. mdl files.
Filename Specification (2) • Example : filename mdl. Test; • Will result in all outputted MDL files named mdl. Test<number>. mdl • <number> is enumerated based on how many times the save function was called in the code.
Function Declarations • If you want to create any functions, they must be declared and defined in the second section. • e. MDL supports macro style functions with no parameters • Every function must have a unique identifier.
Function Declarations (2) • Function declarations consist of the keyword “function” followed by the identifying name • The function body is enclosed in curly braces and can contain of any combination of pre or user defined functions, assignments, or repeat clauses.
Function Declarations (3) • Example : function move 50 { repeat <3> { move sphere 1 <0, 50, 0>; move box 2 <0, -50, 0>; save; } }
Variable Declarations • Must occur between the function declarations and the main body • All variables have a global scope. • Each variable must have its own unique identifier. • Five types of variables.
Variable Types • Integer set <name> as integer <value> • Box set <name> as box <x, y, z, dx, dy, dz> • Line set <name> as line <x, y, z, x 2, y 2, z 2> • Sphere set <name> as sphere <x, y, z, r> • Torus set <name> as torus <x, y, z, r, R>
Main Body • This is where the actual graphic manipulations occur • Any variable declared previously can be changed and moved
Main Body (2) • Users may: – Utilize assignment statements – Call predefined functions – Call user defined functions – Create repeat blocks – Remove a variable – Save the current state to an MDL file
Details of our Compiler
Details of our Compiler • • Lexer – splits code into tokens. Parser – creates an AST. Tree. Walker – generates mdl Code mdl. Parser – mdl Parser generates gif images. (compiled in C)
How We Implemented Our Compiler
emdl. Lexer • Lexer splits emdl code into tokens. • Some common tokens are: – INT – ID, which can be variable names and function names.
emdl. Parser • Parser makes an Abstract Syntax Tree out of the stream of tokens that the Lexer outputs. – Syntax is checked here. – The AST is designed and created here in the most efficient way for static semantic analysis to take place.
emdl. Tree. Walker • Tree. Walker performs the static semantic analysis, as well as the code generation. • A linked list is created to hold all global variables. • The object in linked list knows what type of object the variable is, and all of its parameters.
emdl. Tree. Walker • A copy of the AST is made before we walk through the function declarations. • This is to facilitate function calls. • Each function call creates a copy of the this tree and call a tree. Walker function on this tree. • Since our functions act like macros, the function body is just a sequential continuation of our code.
mdl. Parser • mdl. Parser is a binary executable that is compiled in C. • It asks the user for the names of an mdl file, and the name of the image file to be created. • It then outputs an image file for the given mdl file.
Comparison between emdl and mdl • One of the main reasons for the creation of this language was to extend mdl so that we could make the coding tighter and cleaner. • For the demo you had seen earlier, one emdl file created 9 separate mdl files, which created 9 separate image files.
Comparison between e. MDL and mdl • Now if we had wanted to run the same animation, but with the two outside spheres being farther away from the interior sphere, I would only need to change on line in emdl. • But to do the same change in mdl would require us to modify all 9 of the mdl files that created this animation.
Testing • Tested during and after development.
During Development • Ran two test files when each new functionality was implemented. – One that ought to work – One that ought not and give errors • Didn’t always include all possible formations of newly implemented statements.
After Development • Created suite of test cases – Tested all legal formations of statements. – Tested for what we predicted to be common syntactic and semantic mistakes.
Lessons Learned • Compilers are harder to make than you might think. • Perpetual debugging and error-checking, since errors can and did crop up in the simplest functions.
- Exemple projet mdl
- Mdl information systems
- Symbian malware
- Proyecto mdl
- Mdl lehrer neues dienstrecht
- Microstation mdl programming tutorial pdf
- Calendrier académique gsi
- Maasstad mdl
- Mdl del grupo
- Hardware description language vs programming language
- What is vertical velocity
- Range of motion definition
- Harmonic motion equation
- An object in motion stays in motion
- Chapter 2 section 1 describing motion answer key
- What is acceleration
- Motion section 1 describing motion
- Describing motion chapter 1 lesson 1 answer key
- Motion section 1 describing motion
- Vhsic hardware description language
- Object description language
- What is data definition language (ddl)
- Data description language
- Devider
- Hardware description language
- Is the standard page description language for web pages
- The verilog® hardware description language
- Sdl specification and description language
- Vhsic hardware description language
- List of hardware description languages
- Metaphor poems for kids
- Art extended essay
- Extended investigation critical thinking test
- Brachial artery
- Extended binary tree
- Formation of image of an extended object by a plane mirror
- Examples of extended response
- Ib math extended essay
- Extended response examples
- What is the galleon trade
- Extended gaussian image