an optimized expression extraction in the lookup

This commit is contained in:
krasimir
2017-05-23 21:06:17 +00:00
parent 622274180a
commit cb67a24c99
3 changed files with 344 additions and 131 deletions

View File

@@ -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;