2018-03-15 20:43:46 +00:00
|
|
|
NOTES
|
|
|
|
=====
|
|
|
|
|
|
|
|
2018-03-15
|
|
|
|
----------
|
|
|
|
|
|
|
|
+ chapter 2 - 4.1 of Wirth's [compiler book](http://www.ethoberon.ethz.ch/WirthPubl/CBEAll.pdf)
|
|
|
|
|
|
|
|
stretch buffers:
|
|
|
|
+ dynamically growable arrays such that with a few pitfalls but is easy to generate
|
2018-03-23 22:25:46 +00:00
|
|
|
+ invented by stb?
|
|
|
|
|
|
|
|
|
|
|
|
2018-03-22 (day 2)
|
|
|
|
------------------
|
|
|
|
+ lexing: char stream to token stream
|
|
|
|
+ ex. '1234 (x+y)' translates to '1234' '(' 'x' '+' 'y' ')'
|
|
|
|
+ no semantics yet
|
|
|
|
+ simple hand-written approach
|
2018-03-27 22:59:34 +00:00
|
|
|
+ mark: 1:17:34
|
|
|
|
|
|
|
|
dev log:
|
|
|
|
+ you can use a union with an anonymous struct to add fields to a struct maybe
|
|
|
|
|
|
|
|
struct Thing {
|
|
|
|
int type;
|
|
|
|
union {
|
|
|
|
uint64_t val;
|
|
|
|
struct {
|
|
|
|
int start;
|
|
|
|
int end;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
+ C99 variadic debug macro:
|
|
|
|
|
|
|
|
#ifndef NDEBUG
|
|
|
|
#define tprint(...) do { fprintf(stderr, __VA_ARGS__); } while (false)
|
|
|
|
#else
|
|
|
|
#define tprint(...) do {} while (false)
|
|
|
|
#endif
|
|
|
|
|