Due: Thursday 5/23 10:00am

GitHub link: https://classroom.github.com/a/6TwwlUZx

(MDL actually stands for Motion Description Language)

Before doing anything else, take a look at MDL.spec, it provides important information about the language structure.

There are many commands and features in MDL that we will not be using yet, you should ignore those for now.

Implement the following mdl commands:

  • push
    • Push a copy of the current top of the origins stack onto the origins stack (a full copy, not just a reference to the current top)
  • pop
    • removes the top of the origins stack (nothing needs to be done with this data)
  • move rotate scale
    • create a translation/rotation/scale matrix and multiply the current top by it
    • do not try to use the optional arguments for these commands for now
  • box sphere torus
    • Add a box/sphere/torus to a temporary polygon matrix, multiply it by the current top and draw it to the screen
    • If a constants variable is present, use those for lighting, otherwise, use a default set.
    • Ignore the optional variable at the end of the command.
  • constants
    • You actually don’t need to do anything for this command, the semantic analyzer will already create a symbol table entry for the reflective constants. The main constant work is in the shape commands above.
  • line
    • Add a line to a temporary edge matrix, multiply it by the current top and draw it to the screen
    • Do not try to use the optional arguments for this command
  • save
    • save the screen to the provided file name
  • display
    • show the image

You only need to modify one of the following files (c/python/java):

  • Java
    • MDLReader.java
  • Python
    • script.py
  • C
    • my_main.c
      • look at print_pcode.c, it is an ideal template to follow for my_main.c
    • mdl.y: there is a comment at the very bottom that you will need to check.