GOOL GProc Overview - JacquesCarette/Drasil GitHub Wiki
Warning: Wiki should not be edited directly. Edit the files in the ./wiki/ folder instead and make a PR.
-
drasil-goolexposes two modules:GOOL.hsandGProc.hs.GOOL.hsexports everything that is strictly OO as well as everything that is common between OO and procedural. Likewise,GProc.hsexports everything that is strictly procedural as well as everything that is common between OO and procedural. -
drasil-gool/lib/Drasilis split into three folders to reflect its contents:-
/Shared/contains the "imperative core" shared by GOOL and GProc. -
/GOOLcontains the OO-only code used exclusively by GOOL. -
/GProc/contains the procedural-only code used exclusively by GProc.
-
- Because each of the above folders contains the same types of files, it is esiest to talk about them together:
-
InterfaceCommon.hs,InterfaceGOOL.hs, andInterfaceProc.hsdefine the main external interface, essentially the 'syntax' of GOOL/GProc. This consists of a bunch of typeclasses as well as some smart constructors. The typeclasses for each file are wrapped up in theSharedProg,OOProg, andProcProgtypeclasses, respectively. -
RendererClassesCommon.hs,RendererClassesOO.hs, andRendererClassesProc.hsdefine an internal interface for renderingDocs. The typeclasses of each file are wrapped up inCommonRenderSym,OORenderSym, andProcRenderSym, respectively. -
CodeInfoOO.hsandCodeInfoProc.hsare preprocessors which give the actual language renderers some extra information. They implementOOProgandProcProgrespectively, but notOORenderSymorProcRenderSym. -
CodeType.hsdefines the types that values can have. -
Helpers.hsprovides some miscellaneous functions that are helpful in GOOL. Most of them have to do either with monads in general or with the state monad. -
LanguageRenderer.hsgives some functions that are used by most renderers in their implementations. -
AST.hsdefines what information is kept about various GOOL/GProc constructs. Examples include the type of a value and the name of a variable. This is helpful for when you are given a value and need to know something about it. -
State.hsgives theGOOLState, which keeps track of everything that needs to be kept track of in GOOL/GProc. For example. the AST needs to be kept in theGOOLStateso that we can get information back out of GOOL/GProc constructs later. - There are a few others that you might come across, but these are the main ones.
-
Drasil/GOOL/LanguageRenderercontains the language renderers, as well as modules containing function implementations that are common between multiple renderers.-
LanguagePolymorphic.hscontains function implementations that are shared between all renderers. -
CLike.hscontains function implementations for features that follow the 'classic C-like' structure. -
CommonPseudoOO.hscontains function implementations where not all languages use that implementation, but there's no other pattern between them. -
AbstractProc.hscontains function implementations that are only used by procedural languages. -
Macros.hsgives implementations for functions that are just syntactic sugar - e.g. in Java, C#, and C++, alistSlicetranslates to afor-loop. -
Constructors.hsgives more technical helper functions that have to do with creating values.
-
-