Parse widgets v2 - globals
[clnl] / src / main / package.lisp
1 (defpackage #:clnl (:use :common-lisp)
2  (:export #:run #:boot #:run-commands #:run-reporter #:*model-package*)
3  (:documentation
4   "Main CLNL package
5
6 The entry point for general purpose clnl startup, as well as
7 the place that ties all the parts together into a cohesive whole."))
8
9 (defpackage #:clnl-parser
10  (:use :common-lisp)
11  (:export #:parse)
12  (:documentation
13   "CLNL Parser
14
15 All the code to convert the list of tokens coming from the lexer
16 into an ast that can be transpiled later."))
17
18 (defpackage #:clnl-random
19  (:use :common-lisp)
20  (:shadow #:export)
21  (:export #:export #:set-seed #:next-int #:next-double)
22  (:documentation
23   "Wrapper around mt19937.
24
25 mt19937 implements a merseinne twister that must be adapted a little in
26 order to match the implementation in the main NetLogo codebase which tries
27 to match how java.util.Random works.  Turtles, all the way down."))
28
29 (defpackage #:clnl-transpiler
30  (:use :common-lisp)
31  (:export #:transpile-commands #:transpile-reporter)
32  (:documentation
33   "CLNL Transpiler
34
35 The transpiler is responsible for taking an ast and turning it into valid CL code
36 targeting the nvm.  Here is where start to care about commands versus reporters
37 and ensuring that things are in the right place.  The reason we wait until here
38 is because we want to allow someone else to play with the AST before handing it off
39 to us.  For instance, the command center wants to add \"show\" to reporters, and
40 the users dictate based on entry point whether they are expecting a command
41 or a reporter.  So monitors can say \"hey, transpile this reporter\" and we'll check
42 to make sure it actually is.
43
44 Furthermore, the lisp code that any netlogo code would be transpiled to should
45 use exported symbols, such that anyone writing NetLogo code in lisp could use
46 the nvm in the same way that comes out of this transpiler
47 All the code to convert the list of tokens coming from the lexer
48 into an ast that can be transpiled later."))
49
50 (defpackage #:clnl-nvm
51  (:use :common-lisp)
52  (:export #:export-world #:create-world #:current-state
53   ; API as used by transpiled NetLogo programs
54   #:ask
55   #:create-turtles
56   #:forward
57   #:random-float
58   #:show
59   #:turtles)
60  (:documentation
61   "CLNL NVM
62
63 NetLogo Virtual Machine: the simulation engine."))
64
65 (defpackage #:clnl-lexer
66  (:use :common-lisp)
67  (:export #:lex)
68  (:documentation
69   "CLNL Lexer
70
71 The primary code responsible for tokenizing NetLogo code."))
72
73 (defpackage #:clnl-interface
74  (:use :common-lisp)
75  (:export #:run #:export-view #:initialize)
76  (:documentation
77   "CLNL Interface
78
79 The NetLogo view interface using opengl.  This is responsible for taking the
80 current state of the enging and displaying it.  Will not house any interface
81 components."))
82
83 (defpackage #:clnl-cli
84  (:use :common-lisp :cl-charms/low-level)
85  (:export #:run)
86  (:documentation
87   "CLNL CLI
88
89 The main NetLogo interface for interacting with the program.  Since CLNL is
90 a command line interface program with a view for display purposes only, this
91 is where all the features that the traditional NetLogo UI lives."))
92
93 (defpackage #:clnl-model
94  (:use :common-lisp)
95  (:export #:default-model #:read-from-nlogo #:world-dimensions #:globals)
96  (:documentation
97   "CLNL Model
98
99 The representation, parsing, and serializing of NetLogo model files, including
100 all of the sections, and subsections held within.  This package houses not only
101 the code to read and write .nlogo files, but also the living state of the model
102 as clnl runs."))