]> ocean-lang.org Git - ocean-D/blob - Diary
updates
[ocean-D] / Diary
1 06oct2020
2
3 I want to have a language where '//' is a token - integer division.
4 I want three options in scanner:
5  1/ parse the comment and report it as a token
6  2/ parse the comment and don't report it as a token (i.e. 'ignored')
7  3/ don't parse it, report as TK_mark
8
9 This could apply separately for "#" and "//" and "/*".  But I only have two
10 type: TK_comment and TK_line_comment.
11
12 I could list these as 'known' but that prevents "///" being recognised
13 as a mark.
14
15 12mar2021
16 How to split values from type so they can be small - only one type
17  pointer for an array, for example.
18 Currently a "value" contains both a 'type' and a union of options:
19    str, num, bool, label, array(recursive), structure
20 where some of these include type information.
21
22 To split this I need to keep type and attach it to a var and pass
23 around with a value.  So that value needs to be a pointer to a union?
24 And a size in bytes?
25
26 17mar2021
27  I need to have transient values - registers? - for holding the
28  intermediate result of a computation before assigning to a variable.
29  This is/was 'struct lrval' which was a val and a *lval.
30  Now that a 'struct value' is always a pointer, the 'struct value' can be
31  either the rval or lval, but I need to be able to store
32  content as well - the old 'struct value val'.
33  Maybe I want 'struct value' to still contain the thing (not a pointer)
34  and use 'char  ptr[1]' for generic content.
35
36 10oct2021
37  arrays can have a 'const' as the size - and they can be calculated
38  from the current value of variables.  So how do we allocate them?
39  In particular, how do we handle them appearing in recursive functions?
40
41  For variables with a fixed size - known at function-start at least -
42  we can allocate a stack frame for all of them, and the index off
43  the stack frame.
44  I guess var-sized arrays have a pointer in the stack frame, are
45  allocated when they come into scope, and freed when they go out.
46
47  So I need var-alloc for these to be quite different to other vars
48  All vars need to be initialized when they come into scope, and
49  de-initialized.
50
51  Currently we initialise or re-initialised when entering scope,
52  and only free when exiting program