Rune - Implement runeid_t, hashed identifiers, and #id
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 21 Jan 2021 06:04:50 +0000 (22:04 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 21 Jan 2021 08:34:37 +0000 (00:34 -0800)
commit98c75607ec45e87295946e832cffb5e00921f136
treed516aa6c08f42c41866d0d85863720ad6bd5f5d4
parent359cc150bc5e01887b8dfd00638b8c46c347aff6
Rune - Implement runeid_t, hashed identifiers, and #id

* Expand the lexer to support '#id', which produces a 64-bit
  unsigned integer representing the runeid_t hash for the identifier.

  We now support in total:

  # comment ('#' + space + comment to end of line).  Can be used
for general code comments.

  #%comment ('#' + '%' + comment to end of line).  Can be used
for documentation meta-data.

  #!shell ('#' + '!' + (ignored by parser).  # must be in the
first column.  Used to script the Run interpreter.

  #id Generates a 64-bit runeid_t hash.  Must not be in
the first column (since in the first column this form
represents a preprocessor directive).

  #directive RESERVED FOR FUTURE PREPROCESSOR DIRECTIVES

  To do this, we disallow '#comment' (without whitespace).  It
  only took a few edits of classes to clean those up, so I think
  overloading all of these # features will work out.

* Replace nearly all identifiers stored in various structures
  with the new 64-bit hash runeid_t.  They used to be string-table
  identifiers, now they are not.

  NOTE: The DLL symbol lookups are currently broken due to this
change.

* Add ex_Str to struct Exp for double-quoted strings and anything
  else that still needs to be a string.

* Remove all String_* globals in favor of HASHID_* constants.  Directly
  parse code blocks casing HASHID_* constants instead of using the
  string-table mechanism.  This significantly reudces string-table
  overhead.

* Remove all SPECIAL* string table identifiers in favor of HASHID_*
  switches.

* The Parser now calculates TOK_INTEGER and TOK_FLOAT, and TOK_SSTRING,
  instead of waiting until the resolver gets to it.  This allows us to
  remove remove yet more string table stuff.

* Fix access to dynamic type data in the code generator.
64 files changed:
Makefile.inc
TODO
classes/gadgets/input.d
classes/gfx/event.d
classes/gfx/window.d
classes/sys/class.d
classes/sys/fd.d
classes/sys/proc.d
classes/sys/runtime.d
classes/sys/sys.d
clutter/runeid.c [new file with mode: 0644]
ext_x11/main.c
libgen/backend_llvm.c
libgen/backend_ras.c
libgen/clangdll.c
libgen/defs.h
libgen/export.h
libgen/gen_cast.c
libgen/gen_constructors.c
libgen/gen_emit.c
libgen/gen_exp.c
libgen/gen_oper.c
libgen/gen_refstor.c
libgen/gen_stmt.c
libgen/misc.c
libgen/run_cast.c
libgen/run_constructors.c
libgen/run_exp.c
libgen/run_oper.c
libgen/run_refstor.c
libgen/run_stmt.c
libgen/syscalls.c
libgen/syscalls.h
librune/decl.c
librune/decl.h
librune/defs.h
librune/exp.c
librune/exp.h
librune/export.h
librune/id.c
librune/id.h
librune/lex.c
librune/lex.h
librune/misc.c
librune/parse1.c
librune/parse2.c
librune/parse3.c
librune/resolve.c
librune/stmt.c
librune/stmt.h
librune/strtable.c
librune/sym.h
librune/type.c
librune/type.h
librune/typeq.c
librune/types.h
libruntime/Makefile
libruntime/context.h [new file with mode: 0644]
libruntime/fatal.c [new file with mode: 0644]
libruntime/icrc32.c [new file with mode: 0644]
libruntime/id.c [new file with mode: 0644]
libruntime/mkdirpath.c
rune/Makefile
tests/sstr.d