Code reformat - Break up nvm files, package declaration based on dictionary grouping
[clnl] / src / main / package.lisp
1 (defpackage #:clnl (:use :common-lisp)
2  (:export
3   #:run #:boot #:run-commands #:run-reporter #:*model-package*
4   #:model->multi-form-lisp #:model->single-form-lisp)
5  (:documentation
6   "Main CLNL package
7
8 The entry point for general purpose clnl startup, as well as
9 the place that ties all the parts together into a cohesive whole."))
10
11 (defpackage #:clnl-parser
12  (:use :common-lisp)
13  (:export #:parse)
14  (:documentation
15   "CLNL Parser
16
17 All the code to convert the list of tokens coming from the lexer
18 into an ast that can be transpiled later."))
19
20 (defpackage #:clnl-code-parser
21  (:use :common-lisp)
22  (:export #:parse #:globals #:procedures #:turtles-own-vars #:patches-own-vars #:breeds)
23  (:documentation
24   "CLNL Code Parser
25
26 A parser specifically for code from NetLogo models, that turns the lexed
27 ast from an entire structured file into something more defined.
28
29 This is different from the general parser (in clnl-parser) in that
30 it's made for parsing the code section of nlogo files, and so works
31 outside of the constraints.  In NetLogo, I believe this is analagous
32 to the StructureParser, but I'm guessing there's weird overlap with
33 other things."))
34
35 (defpackage #:clnl-random
36  (:use :common-lisp)
37  (:shadow #:export)
38  (:export #:export #:set-seed #:next-int #:next-double #:next-long)
39  (:documentation
40   "Wrapper around mt19937.
41
42 mt19937 implements a merseinne twister that must be adapted a little in
43 order to match the implementation in the main NetLogo codebase which tries
44 to match how java.util.Random works.  Turtles, all the way down."))
45
46 (defpackage #:clnl-transpiler
47  (:use :common-lisp)
48  (:export #:transpile #:reporter-p #:command-list-p)
49  (:documentation
50   "CLNL Transpiler
51
52 The transpiler is responsible for taking an ast and turning it into valid CL code
53 targeting the nvm.  Here is where start to care about commands versus reporters
54 and ensuring that things are in the right place.  The reason we wait until here
55 is because we want to allow someone else to play with the AST before handing it off
56 to us.  For instance, the command center wants to add \"show\" to reporters, and
57 the users dictate based on entry point whether they are expecting a command
58 or a reporter.  So monitors can say \"hey, transpile this reporter\" and we'll check
59 to make sure it actually is.
60
61 Furthermore, the lisp code that any netlogo code would be transpiled to should
62 use exported symbols, such that anyone writing NetLogo code in lisp could use
63 the nvm in the same way that comes out of this transpiler
64 All the code to convert the list of tokens coming from the lexer
65 into an ast that can be transpiled later."))
66
67 (defpackage #:clnl-lexer
68  (:use :common-lisp)
69  (:export #:lex)
70  (:documentation
71   "CLNL Lexer
72
73 The primary code responsible for tokenizing NetLogo code."))
74
75 (defpackage #:clnl-interface
76  (:use :common-lisp)
77  (:export #:run #:export-view #:initialize)
78  (:documentation
79   "CLNL Interface
80
81 The NetLogo view interface using opengl.  This is responsible for taking the
82 current state of the enging and displaying it.  Will not house any interface
83 components."))
84
85 (defpackage #:clnl-cli
86  (:use :common-lisp :cl-charms/low-level)
87  (:export #:run)
88  (:documentation
89   "CLNL CLI
90
91 The main NetLogo interface for interacting with the program.  Since CLNL is
92 a command line interface program with a view for display purposes only, this
93 is where all the features that the traditional NetLogo UI lives."))
94
95 (defpackage #:clnl-model
96  (:use :common-lisp)
97  (:export #:default-model #:read-from-nlogo #:world-dimensions #:widget-globals #:code)
98  (:documentation
99   "CLNL Model
100
101 The representation, parsing, and serializing of NetLogo model files, including
102 all of the sections, and subsections held within.  This package houses not only
103 the code to read and write .nlogo files, but also the living state of the model
104 as clnl runs."))
105
106 (defpackage #:clnl-extensions
107  (:use :common-lisp)
108  (:export #:load-extension)
109  (:documentation
110   "CLNL Extensions
111
112 The loading and handling of extensions to CLNL modeled after the way that
113 NetLogo handles extensions.
114
115 Extensions are defined as Common Lisp systems (under asdf) that export
116 the primitive PRIMS.  The name of the asdf system is defined to be the
117 name of the extension prepended by CLNL-EXTENSION-, such that for a hypothetical
118 extension ARRAY, the name of the asdf system would be CLNL-EXTENSION-ARRAY
119 and found through conventional asdf means.  The package that the required
120 functions are symbols in should be the same as the asdf system."))
121
122 (defpackage #:clnl-default-model-package
123  (:use :common-lisp)
124  (:shadow #:go))