astDataRepresentation.h

Description du code

Représentation de données de l'arbre syntaxique abstrait Compilateur LSD010

Code source ou contenu du fichier

  1. /*
  2.  * astDataRepresentation.h :
  3.  * Exposes the data representation of the Abstract Syntaxic Tree
  4.  * Don't include this if not really needed.
  5.  * All "public" functions are available on the ast.h
  6.  * Part of the compiler project for LSD10 language
  7.  * Gaudry Stéphane
  8.  * More information on http://www.gaudry.be/langages-analyse-syntaxique-ast.html
  9.  * **********************************************************
  10.  */
  11. #ifndef AST_DATAREP_H
  12. #define AST_DATAREP_H
  13. #include "common.h"
  14.  
  15. /**
  16. * Debug informations
  17. */
  18. struct debugInfo{
  19. char* file;
  20. int line;
  21. int linePsn;
  22. };
  23. typedef struct debugInfo DebugInfo;
  24.  
  25. /**
  26. * Value informations
  27. */
  28. struct astNodeInfo{
  29. /*ID, Name of the item (variable, function, etc.)*/
  30. char *name;
  31. /* avoid calling more than once the type*/
  32. int computedType;
  33. /*LSD10 Type of the item, one of the LEXICAL_VAR_TYPE_xxx constants*/
  34. int type;
  35. /*
  36. Integer value for the integer vars
  37. O (false) or 1 (true) for the boolean vars
  38. */
  39. int value;
  40. /*
  41. Used for the ID and function call nodes, NULL otherwise
  42. */
  43. struct astNode *declarationNode;
  44. /*
  45. Used for the "declaration" nodes, NULL otherwise
  46. */
  47. int memoryLocation;
  48. /*
  49. Used for the functions nodes
  50. astNode pointer if return statement is found, NULL otherwise
  51. */
  52. struct astNode *returnStatement;
  53. int scopeId;
  54. int scopeDepth;
  55. };
  56. typedef struct astNodeInfo AstNodeInfo;
  57.  
  58. /**
  59. * Structure informations
  60. */
  61. struct astNode {
  62. /*One of the NODE_TYPE_xxx constant*/
  63. int type;
  64. /*Value information*/
  65. AstNodeInfo *info;
  66. DebugInfo *debug;
  67. struct astNode *parent;
  68. struct astNode *right;
  69. struct astNode *left;
  70. /*
  71. * One of the NODE_TYPE_xxx constant
  72. * todo : use only type and create more constants
  73. */
  74. int subtype;
  75. };
  76. typedef struct astNode AstNode;
  77. //typedef struct astNode *AstNodePtr;
  78.  
  79. #endif

Autres extraits de codes en c

  • DisquetteDispo Vérifier la disponibilité du lecteur de disquette
  • Suite de Fibonacci Exemple d'itération en C
  • Suite de Fibonacci Exemple de récursion en C
  • astDataRepresentation.h Représentation de données de l'arbre syntaxique abstrait Compilateur LSD010
  • ast.h Arbre syntaxique abstrait Compilateur LSD010
  • ast.c Arbre syntaxique abstrait Compilateur LSD010
  • symbolsTableDataRepresentation.h Représentation de données de la table des symboles Compilateur LSD010
  • symbolsTable.h Fonctions de gestion de la table des symboles Compilateur LSD010
  • symbolsTable.c Fonctions de gestion de la table des symboles Compilateur LSD010
  • hashCode.h Fonctions de hachage Compilateur LSD010
  • hashCode.c Fonctions de hachage Compilateur LSD010
  • scopeStack.h Fonctions de gestion d'une pile de portées Compilateur LSD010
  • scopeStack.c Fonctions de gestion d'une pile de portées Compilateur LSD010
  • scopeHelper.h Fonctions de gestion de la portée courante Compilateur LSD010
  • console.h Fonctions d'affichage Compilateur LSD010
  • console.c Fonctions d'affichage Compilateur LSD010
  • graphVizHelper.h Génération d'une image d'un arbre syntaxique abstrait.
    Classe d'intégration de l'outil GraphViz. Compilateur LSD010
  • graphVizHelper.c Génération d'une image d'un arbre syntaxique abstrait.
    Classe d'intégration de l'outil GraphViz. Compilateur LSD010
  • common.h Définition des constantes et variables communes Compilateur LSD010
  • pcode.c Génération de p-code Compilateur LSD010
  • pcode.h Génération de p-code Compilateur LSD010
  • Tous les extraits

Document créé le 05/10/2009, dernière modification le 28/10/2018
Source du document imprimé : https://www.gaudry.be/sniplet-rf-lsd010/project/source/astDataRepresentation.h.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.