1 (defpackage #:clnl (:use :common-lisp)
3 #:run #:boot #:run-commands #:run-reporter #:*model-package*
4 #:model->multi-form-lisp #:model->single-form-lisp)
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."))
11 (defpackage #:clnl-parser
17 All the code to convert the list of tokens coming from the lexer
18 into an ast that can be transpiled later."))
20 (defpackage #:clnl-code-parser
22 (:export #:parse #:globals)
26 A parser specifically for code from NetLogo models, that turns the lexed
27 ast from an entire structured file into something more defined.
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
35 (defpackage #:clnl-random
38 (:export #:export #:set-seed #:next-int #:next-double #:next-long)
40 "Wrapper around mt19937.
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."))
46 (defpackage #:clnl-transpiler
48 (:export #:transpile #:reporter-p #:command-list-p)
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.
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."))
67 (defpackage #:clnl-nvm
69 (:shadow #:random #:count)
70 (:export #:export-world #:create-world #:current-state #:with-stop-handler
71 ; API as used by transpiled NetLogo programs
97 #:turn-right #:turn-left
102 NetLogo Virtual Machine: the simulation engine."))
104 (defpackage #:clnl-lexer
110 The primary code responsible for tokenizing NetLogo code."))
112 (defpackage #:clnl-interface
114 (:export #:run #:export-view #:initialize)
118 The NetLogo view interface using opengl. This is responsible for taking the
119 current state of the enging and displaying it. Will not house any interface
122 (defpackage #:clnl-cli
123 (:use :common-lisp :cl-charms/low-level)
128 The main NetLogo interface for interacting with the program. Since CLNL is
129 a command line interface program with a view for display purposes only, this
130 is where all the features that the traditional NetLogo UI lives."))
132 (defpackage #:clnl-model
134 (:export #:default-model #:read-from-nlogo #:world-dimensions #:widget-globals #:code)
138 The representation, parsing, and serializing of NetLogo model files, including
139 all of the sections, and subsections held within. This package houses not only
140 the code to read and write .nlogo files, but also the living state of the model