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