Developing a simplified Bro IDS

Hi!
I’m trying to develop a simplified Bro IDS on ClickOS. Can anyone help me to identify some of the core source code that is about the event engine and scrip interpreter?

Thanks!

Ray