diff options
| author | krasimir <krasimir@chalmers.se> | 2017-05-23 21:06:17 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2017-05-23 21:06:17 +0000 |
| commit | cb67a24c99c9490074cd62a1fa8cd9e0ac45c948 (patch) | |
| tree | f33a64c3a0ae8fd4e61d4c0751ec929f44cfea6f /src/runtime/c/pgf/linearizer.h | |
| parent | 622274180af2e3bd64ced3e191319dc5be3aa4d1 (diff) | |
an optimized expression extraction in the lookup
Diffstat (limited to 'src/runtime/c/pgf/linearizer.h')
| -rw-r--r-- | src/runtime/c/pgf/linearizer.h | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/src/runtime/c/pgf/linearizer.h b/src/runtime/c/pgf/linearizer.h index 2c98299b2..6aeffb4e0 100644 --- a/src/runtime/c/pgf/linearizer.h +++ b/src/runtime/c/pgf/linearizer.h @@ -4,23 +4,48 @@ #include <gu/enum.h> /// Linearization of abstract syntax trees. -/// @file - -/** @} - * - * @name Enumerating concrete syntax trees - * - * Because of the \c variants construct in GF, there may be several - * possible concrete syntax trees that correspond to a given abstract - * syntax tree. These can be enumerated with #pgf_concretize. - * - * @{ - */ +// +// PgfCncTree +// /// A concrete syntax tree typedef GuVariant PgfCncTree; +typedef enum { + PGF_CNC_TREE_APP, + PGF_CNC_TREE_CHUNKS, + PGF_CNC_TREE_LIT, +} PgfCncTreeTag; + +typedef struct { + PgfCCat* ccat; + PgfCncFun* fun; + int fid; + + size_t n_vars; + PgfPrintContext* context; + + size_t n_args; + PgfCncTree args[]; +} PgfCncTreeApp; + +typedef struct { + size_t n_vars; + PgfPrintContext* context; + + size_t n_args; + PgfCncTree args[]; +} PgfCncTreeChunks; + +typedef struct { + size_t n_vars; + PgfPrintContext* context; + + int fid; + PgfLiteral lit; +} PgfCncTreeLit; + /// An enumeration of #PgfCncTree trees. typedef GuEnum PgfCncTreeEnum; |
