From 3f261c2854ce1e4916b40154fda289d8ea064108 Mon Sep 17 00:00:00 2001 From: krangelov Date: Sun, 7 Nov 2021 19:45:11 +0100 Subject: [PATCH] first draft of the data model for the concrete syntax --- src/runtime/c/pgf/data.h | 104 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/src/runtime/c/pgf/data.h b/src/runtime/c/pgf/data.h index 84ece00ba..d30fd7a8b 100644 --- a/src/runtime/c/pgf/data.h +++ b/src/runtime/c/pgf/data.h @@ -104,10 +104,114 @@ typedef struct { Namespace cats; } PgfAbstr; +struct PGF_INTERNAL_DECL PgfConcrLincat { + size_t ref_count; + ref>> fields; + PgfText name; + + static void release(ref lincat); +}; + +struct PGF_INTERNAL_DECL PgfConcrLIndex { + size_t i0; + size_t n_terms; + struct { + size_t factor; + size_t var; + } terms[]; +}; + +struct PGF_INTERNAL_DECL PgfConcrLinArg { + ref lincat; + ref param; +}; + +struct PGF_INTERNAL_DECL PgfConcrLinRes { + ref lincat; + ref param; +}; + +typedef object PgfSymbol; + +struct PGF_INTERNAL_DECL PgfSymbolIdx { + size_t d; + ref r; +}; + +struct PGF_INTERNAL_DECL PgfSymbolCat : PgfSymbolIdx { + static const uint8_t tag = 0; +}; + +struct PGF_INTERNAL_DECL PgfSymbolLit : PgfSymbolIdx { + static const uint8_t tag = 1; +}; + +struct PGF_INTERNAL_DECL PgfSymbolVar { + static const uint8_t tag = 2; + size_t d, r; +}; + +struct PGF_INTERNAL_DECL PgfSymbolKS : PgfText { + static const uint8_t tag = 3; +}; + +struct PGF_INTERNAL_DECL PgfSymbolKP { + static const uint8_t tag = 4; +}; + +struct PGF_INTERNAL_DECL PgfSymbolBIND { + static const uint8_t tag = 5; +}; + +struct PGF_INTERNAL_DECL PgfSymbolSOFTBIND { + static const uint8_t tag = 6; +}; + +struct PGF_INTERNAL_DECL PgfSymbolNE { + static const uint8_t tag = 7; +}; + +struct PGF_INTERNAL_DECL PgfSymbolSOFTSPACE { + static const uint8_t tag = 8; +}; + +struct PGF_INTERNAL_DECL PgfSymbolCAPIT { + static const uint8_t tag = 9; +}; + +struct PGF_INTERNAL_DECL PgfSymbolALLCAPIT { + static const uint8_t tag = 10; +}; + +typedef PgfVector PgfSequence; + +struct PGF_INTERNAL_DECL PgfConcrLin { + size_t ref_count; + + ref> args; + ref> res; + ref>> seqs; + + PgfText name; + + static void release(ref lin); +}; + +struct PGF_INTERNAL_DECL PgfConcrPrintname { + size_t ref_count; + ref printname; + PgfText name; + + static void release(ref printname); +}; + struct PGF_INTERNAL_DECL PgfConcr { size_t ref_count; size_t ref_count_ex; Namespace cflags; + Namespace lins; + Namespace lincats; + Namespace printnames; // If there are references from the host language to this concrete, // then it is included in a double-linked list. If a process