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-model
89 #:execute-button #:default-model #:read-from-nlogo #:world-dimensions #:widget-globals #:code
90 #:buttons #:forever-button-on #:view #:interface #:set-current-interface #:set-callback)
94 The representation, parsing, and serializing of NetLogo model files, including
95 all of the sections, and subsections held within. This package houses not only
96 the code to read and write .nlogo files, but also the living state of the model
99 (defpackage #:clnl-extensions
101 (:export #:load-extension #:prims)
105 The loading and handling of extensions to CLNL modeled after the way that
106 NetLogo handles extensions.
108 Extensions are defined as Common Lisp systems (under asdf) that export
109 the primitive PRIMS. The name of the asdf system is defined to be the
110 name of the extension prepended by CLNL-EXTENSION-, such that for a hypothetical
111 extension ARRAY, the name of the asdf system would be CLNL-EXTENSION-ARRAY
112 and found through conventional asdf means. The package that the required
113 functions are symbols in should be the same as the asdf system."))
115 (defpackage #:clnl-default-model-package