1 (defpackage #:clnl (:use :common-lisp)
3 #:run #:boot #:run-commands #:run-reporter #:*model-package*
4 #:model->multi-form-lisp #:model->single-form-lisp
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."))
12 (defpackage #:clnl-parser
18 All the code to convert the list of tokens coming from the lexer
19 into an ast that can be transpiled later."))
21 (defpackage #:clnl-code-parser
23 (:export #:parse #:globals #:procedures #:turtles-own-vars #:patches-own-vars #:breeds)
27 A parser specifically for code from NetLogo models, that turns the lexed
28 ast from an entire structured file into something more defined.
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
36 (defpackage #:clnl-random
39 (:export #:export #:set-seed #:next-int #:next-double #:next-long)
41 "Wrapper around mt19937.
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."))
47 (defpackage #:clnl-transpiler
49 (:export #:transpile #:reporter-p #:command-list-p)
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.
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."))
68 (defpackage #:clnl-lexer
74 The primary code responsible for tokenizing NetLogo code."))
76 (defpackage #:clnl-interface
78 (:export #:run #:export-view #:initialize)
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
86 (defpackage #:clnl-cli
87 (:use :common-lisp :cl-charms/low-level)
92 The main NetLogo interface for interacting with the program. Since CLNL is
93 a command line interface program with a view for display purposes only, this
94 is where all the features that the traditional NetLogo UI lives."))
96 (defpackage #:clnl-model
98 (:export #:default-model #:read-from-nlogo #:world-dimensions #:widget-globals #:code)
102 The representation, parsing, and serializing of NetLogo model files, including
103 all of the sections, and subsections held within. This package houses not only
104 the code to read and write .nlogo files, but also the living state of the model
107 (defpackage #:clnl-extensions
109 (:export #:load-extension)
113 The loading and handling of extensions to CLNL modeled after the way that
114 NetLogo handles extensions.
116 Extensions are defined as Common Lisp systems (under asdf) that export
117 the primitive PRIMS. The name of the asdf system is defined to be the
118 name of the extension prepended by CLNL-EXTENSION-, such that for a hypothetical
119 extension ARRAY, the name of the asdf system would be CLNL-EXTENSION-ARRAY
120 and found through conventional asdf means. The package that the required
121 functions are symbols in should be the same as the asdf system."))
123 (defpackage #:clnl-default-model-package