Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

TDoc - Bringing Documentation to Tool

403 views

Published on

Prefinal Report for the Compiler Construction Course 2010 at EPFL in Switzerland.

Published in: Technology
  • Be the first to like this

TDoc - Bringing Documentation to Tool

  1. 1. TDoc Bringing Documentation to Tool Andrea Gallidabino Florian Gysin Compiler Construction 2010
  2. 2. Vision <ul><li>Coding is hard
  3. 3. Old / foreign code = harder </li></ul>
  4. 4. Vision <ul><li>Coding is hard
  5. 5. Old / foreign code = harder
  6. 6. Support developers with documentation </li></ul>
  7. 7. <ul><li>TDoc = Tool Documentation
  8. 8. Documentation Framework
  9. 9. Similar to JavaDoc
  10. 10. Annotated Comments </li></ul>General Idea
  11. 11. <ul><li>Progress up to now
  12. 12. Example Doc
  13. 13. Not yet finished! </li></ul>Demo
  14. 14. AST Base Implementation Code Generator Parser Lexer Analyzer recursive descent add/connect symbols check types used CAFEBABE ready to run... lookahead of one source code JVM Code
  15. 15. <ul><li>Annotated comments
  16. 16. Describe: </li><ul><li>Parameters
  17. 17. Return value </li></ul><li>Generates .html </li></ul>@Comments /* * The method foo will say hello * if you ask it nicely. * @param name Your name. * @return A friendly greeting. */ def foo(name:String) : String = { return “hello” + name; }
  18. 18. <ul><li>Assertions for methods in comments
  19. 19. Checked on runtime
  20. 20. Throw exceptions if not satisfied </li></ul>@Preconditions /* * The method divide will divide * two integers. * @precondition b != 0 */ def divide(a:int, b:int) : int = { return a / b; }
  21. 21. AST <ul><li>tokenize comment lines
  22. 22. parse the one expression
  23. 23. symbol and type check
  24. 24. put stuff into AST
  25. 25. generate assertion code </li></ul>TDoc Implementation Code Generator Parser Lexer Analyzer TDoc Generator comments source code JVM Code Html Doc
  26. 26. <ul><li>Make it actually work...
  27. 27. Obvious: introduce postconditions
  28. 28. variable condition : assert certain value/range through the whole method </li></ul>Things to do...
  29. 29. <ul><li>Support developers with documentation </li></ul>Summary
  30. 30. <ul><li>Support developers with documentation
  31. 31. Use TDoc </li><ul><li>annotate comments
  32. 32. Preconditions </li></ul></ul>Summary
  33. 33. <ul><li>Support developers with documentation
  34. 34. Use TDoc </li><ul><li>annotate comments
  35. 35. Preconditions </li></ul><li>Question? </li></ul>Summary

×