-
Notifications
You must be signed in to change notification settings - Fork 1
/
TODO
181 lines (132 loc) · 6.86 KB
/
TODO
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<!--******************************************************************
* Copyright (c) 2000-2018, 2019 S.Bhatnagar
*
# This file is part of fussy.
#
# fussy is a free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# fussy is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with fussy. If not, see <https://www.gnu.org/licenses/>.
*
******************************************************************-->
X Add function and procedure declarations in the grammar. [DONE]
A procedure which calls "return expr" becomes a function which
can be used in an expression. A procedure cannot be used in
an expression.
X Allow declaration of local variables/arguments in functions/procedures [DONE]
and arguments should be passed as formal named arguments.
DONE
X Allow storing partial results in temp. variables. [DONE]
X BUG: Currently, when this is done, the errors don't propagate properly [DONE]
when the temp. variables are used in an expressions. This is
because the symbol table (which is where temp variables reside)
cannot hold an object from the stack (which is where the partial
results are properly handled).
DONE Nov. 2003
o Ultimately, allow arrays (on an if-and-when-required basis!)!
o Write the document!
Current doc is more of a note-book for the author.
Submitted a paper to ACM TOMS.
Nov.17, 2003
o Have someone build a graphic calculator for this? (Welll....)
o In the interactive mode, add commands to give help on various
language constructs.
[LOW PRIORITY] Needed at all?
X Handle error propagation a bit more robustly. [DONE] See fussy.tex for details.
Algo. designed.
Implementation in progress.
Dec. 2001
Implemented for expression and not too deep function calls.
28Dec 2001
New List (Dec 17, 2003):
------------------------
X Better garbage collection. [DONE!]
IDs are now optimally allocated (i.e., a unique ID is assigned only
for symbols/constants which will produce a finite propagated
error). However the IDs are not contiguous. E.g. the allocated
IDs can be 0,1,7,8. The size of DS and MeasurementError arrays is
equal the highest allocated ID plus 1. Hence, although the size of
these arrays for the above examples needs to be only 4 long, it
will be 8 long and will only use 4 locations from it.
The garbage collector needs to re-assign the IDs making them
contiguous and systematically change to the values everywhere in
the compiled VM code. This will reduce the runtime memory usage.
It is however not clear to me at this stage if this is a good idea
(such a garbage collector). If non-contiguous IDs get allocated
only because of auto variables in a sub-program - then it's better
to leave it that way. The arrays will not need to be resized when
the sub-programs are called (the IDs which were released after the
sub-program definition was finished will be used).
This was easier than I thought. IDs are simply not allocated
during sub-program construction phase for auto variables.
This eliminates non-contiguous ID allocation and hence the
need for an improved garbage collector! :)) Dec., 2003
o A read command.
o Ability to pass arguments by reference.
X The increment and decrement (++ and --) operators. [Done]
o Implement the <op>= operators.
o CAVEAT: Code of the following type will give inconsistent results.
When a auto defined variable is converted into a partial
var. composed of other auto. vars and returned, the IDList of the
return var. carries IDs of the temp. auto vars. When the
sub-program returns, these temp. auto var. IDs are released. If the
return value of the function is used to created another partial
var., the resulting partial var will have IDs which are undefined
now. The following code illustrates this:
g(x) { auto tt,c; c=3pm1; tt:=c; return tt; } t:=g(10pm1);
Have to think how to resolve this problem.
X BUG: x:=10;f(x){return x;} gives a syntax error. [DONE]
If the argument in a function declaration has the same name as a
global PARTIAL_VAR, sub-program declaration breaks. It should not
(the argument is in the scope of the sub-program and resides in the
LocalSymbTab and hence can have same name).
X BUG: The following code sets the value of the global variable y to zero! [DONE]
y:=10;f(x){return x;}
This is because the interpretor detects a function declaration. It
then emits the instructions for the function. The instructions
emitted for the first assignment statement also remains in the VM
and are never executed (since the instructions for a function are
not automatically executed - they are executed only when the
function is called).
Need to remember the value of PC before the line is parsed. And run
the VM from this value of the PC to the value of the PC where a
sub-program declaration begins.
X BUG: Code after the func. declaration in the parsing cycle is never executed. [DONE]
E.g., after the following code segement, x is still undefined.
f(){;};x=10;
The "defn" rule was returning zero. It should not return at all and
instead set the "pc" (the program counter) to the base of the Virtual
Machine (held in the "Prog" variable). The vcode is emitted at this
location in the VM and also executed from there on.
X BUG: String assignment to auto variables does not work. [DONE]
X BUG: Seg fault in case of a syntax error involving an auto var. [DONE]
This is fixed! [July 18,2005]
The problem was in the cleanup operation to clear the symbol table
of zombie symbols. In this case, it was the "test" symbol of type
{P,F}SUC_TYPE. This symbol should be removed since the error exception
was thrown during the construction of the body of the sub-program.
X BUG: The following code generates a seg. fault (in CleanupLocalSymbTab()) [DONE]
AFTER it prints the error message:
test()
{
auto tx;
tx-=2;
}
The "-=" operator is not defined in the language. When doing the
garbage collection after the error detection during parsing, the
auto symbol in the local symbol table is not constructed (has no
type - that's assigned at runtime). This is a problem in
CleanupLocalSymbTab() which assumes that all symbols are properly
initialized.
UPDATE:
This actually does not generate seg. fault, but gives the following
syntax error message:
###Error: syntax error near token '=' in "tx-=2;"