Friday, September 26, 2008

Grammarian First Light

At 02:14, 27 September 2008, Grammarian.pm successfully parsed the document pragma trigger of this document:

;;; hello, world
;;;
;;; simplest correct document

[[document title;'hello.carrot']]

hello, world! ;;; document plaintext

With this, 3 years of effort comes to fruition, and Carrot takes a giant step towards being real. Here's what happened:
  1. A Grammarian object is instantiated
  2. A Lexer object is instantiated within the Grammarian
  3. The Grammarian, controlling the Lexer, reads through the document until something that isn't a comment or whitespace comes along
  4. A Document pragma handler is instantiated
  5. The Document handler is asked if it handles the token the Grammarian is looking at
  6. If not, the document is nonconformant, a status is set, and processing terminates here
  7. Else, the Document handler is passed control of the Lexer
  8. If all goes well, the Document handler parses the contents of the document trigger into a datastructure, which is returned to the Grammarian
  9. The Grammarian then instantiates a DOM object, giving it the results of the Document handlers's work as the root node of the new document
  10. I do a little dance because it works It Works IT WORKS!!

Tomorrow I'll be writing (lots) more tests, and I hope to have a demo online by Wednesday, 1 October.

No comments: