/
readme.txt
164 lines (121 loc) · 4.14 KB
/
readme.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
Easy-ISLisp(EISL) is an interpreter and compiler compatible with ISLisp standard.EISL was written by me(Kenichi Sasagawa)
https://qiita.com/sym_num/items/793adfe118514668e5b0
Installation
On Linux type "make" on terminal.
On Windows rename winmakefile -> makefile. and type "make" on terminal.
Require MINGW gcc
We confirmed the operation in the following environment.
Ubuntu 16.04 GCC 5.4
Raspbery Pi3
Windows10 MINGW GCC 5,3
Invoke
eisl (Windows)
./eisl (Linux)
Linux version, REPL is editable. If you not use editable REPL, invoke with -r option.
./eisl -r
Goal
I hope that Lisp will become more popular. I hope many people enjoy Lisp. EISL aims at easy handling.
Compiler
EISL has compiler. it generate GCC code and generate object code.
Invoke with -c option
./eisl -c compiler.lsp
or (load "compiler.lsp")
(compile-file "foo.lsp")
(load "foo.o")
Builtin editor
EISL(Linux version) has builtin editor.
Invoke editor
(edit file-name-string) example (edit "foo.lsp")
(edit nil) edit recent file again.
Command
CTR+O save file.
CTRL+X quit editor.
CTRL+K delete selection.
CTRL+U paste from clip board.
Editing
↑↓←→ move cursol
ESC A mark current row position. After this operation, cursol up or down reverse selected rows. ESC A again, unmark. Similer to nano editor
Enter key insert tab for Lisp automatic
Insert key switch insert/overwrite
Tab key insert tab for Lisp
BackSpace key delete backword char
Delete key delete forwaord char
Home key display top page
ESC |(SSH)
End key display end page
ESC /(SSH)
PageUp key PageUp
Ctrl+Y(SSH)
PageDown PageDown
Ctrl+V(SSH)
ESC TAB completion.
Setting
(set-editor 'indent 'auto) set auto indent mode.
(set-editor 'indent 'manual) set manual indet mode. To indent tab key.
(set-editor 'tab 'lisp) set tab for Lisp style.
(set-editor 'tab 2) set tab 2.
(set-editor 'tab 4) set tab 4.
(set-editor 'tab 8) set tab 8.
syntax highlighting.
n = 0-7
0=Black, 1=Red, 2 =Green, 4=Blue, 5=Maggenta, 6=Syan, 7=White.
(set-editor 'syntax-color n)
(set-editor 'builtin-color n)
(set-editor 'extended-color n)
(set-editor 'string-color n)
(set-editor 'comment-color n)
WiringPi
Version for Raspberry include library for wiringPi.
In order to use wiringPi, you need to invoke EISL with super user.
sudo ./eisl
and (load "wiringpi.o")
please see exsample code "led.lsp"
"wiringpi.lsp" is source code of wiringpi.o.
EISL <==================================> C
(wiringpi-spi-setup ch speed) <===> wiringPiSPISetup (SPI_CH, SPI_SPEED)
(wiringpi-setup-gpio ) <===> wiringPiSetupGpio()
(pin-mode n 'output) <====> pinMode(n, OUTPUT) or 'input -> INPUT 'pwm-output -> PWM-OUTPUT
(digital-write n v) <===> digitalWrite(n, v)
(digital-write-byte v) <===> digitalWriteByte(value)
(digital-read pin) <===> digitalRead(pin)
(delay howlong) <===> void delay(unsigned int howLong)
(pull-up-dn-control pin pud) <===> pullUpDnControl(pin,pud)
(pwm-set-mode 'pwm-mode-ms) <===> pwmSetMode(PWM_MODE_MS); or 'pwm-mode-bal -> PWM_MODE_BAL
(pwm-set-clock n) <===> pwmSetClock(n)
(pwm-set-range n) <===> pwmSetRange(n)
(pwm-write pin value) <===> pwmWrite(pin , value)
Following code is examples.
;;LED on/off
(defglobal pin 5)
(defglobal flag nil)
(defun test (n)
(cond ((null flag) (wiringpi-setup-gpio)(setq flag t)))
(pin-mode pin 'output)
(for ((i 0 (+ i 1)))
((> i n) t)
(digital-write pin 1)
(delay 1000)
(digital-write pin 0)
(delay 1000)))
;;control servo moter.
;;SG90 Micro servo Digital 9g
(defun setup ()
(cond ((null flag) (wiringpi-setup-gpio ) (setq flag t)))
(pin-mode 18 'pwm-output)
(pwm-set-mode 'pwm-mode-ms)
(pwm-set-clock 400)
(pwm-set-range 1024))
(defun test (n)
(pwm-write 18 n))
Functions for debug
(trace fn1 fn2 ... fn)
(untrace fn1 fn2 ... fn) or (untrace)
(backtrace)
(break)
(macroexpand-1)
Extended functions
(random n) random-integer from 0 to n
(random-real) random-float-number from 0 to 1
(gbc) invoke garbage collection.
(gbc t) display message when invoke GC.
(gbc nil) not display message when invoke GC.