symbolsTable.h
Description du code
symbolsTable.h est un fichier du projet Compilateur LSD010.Ce fichier est situé dans /var/www/bin/sniplets/lsd010/.
Projet Compilateur LSD010 :
Compilateur LSD010 développé dans le cadre du cours de syntaxe et sémantiqueref 1
Code source ou contenu du fichier
Code c (symbolsTable.h) (96 lignes)
/* * symbolsTable.h : Exposed items to manage the symbols table * Part of the compiler project for LSD10 language * Gaudry Stéphane * More information on http://www.gaudry.be/langages-table-des-symboles.html * ********************************************************** */ #ifndef SYMBOLS_TABLE_H #define SYMBOLS_TABLE_H #include "common.h" /** * Allows to detect unused variables. */ typedef enum { VAR_USAGE_NEVER, VAR_USAGE_SOMETIMES, VAR_USAGE_ALWAYS }VariableUsage; /** * Sets usage for a declared variable * @param currentVarNode variable node * @param usage one of the VAR_USAGE_SOMETIMES or VAR_USAGE_ALWAYS values * pre-conditions : currentVarNode is a variable node */ int setUsage(AstNode *currentVarNode, VariableUsage usage); /** * @return 1 if the symbols table is available, 0 otherwise */ int isSymbolsTableAvailable(); /** * Creates a new data storage for the symbols management */ void initializeSymbolsTable(); /** * Free all resources */ void finalizeSymbolsTable(); /** * Enters into a new scope */ void enterScope(); /** * Enters into a new function scope */ int enterFunctionScope(AstNode* functionNode); /** * Exits from the current scope, and return to the parent scope if exists */ void exitScope(); /** * Adds informations about a declaration * All information is given from a declaration node from the AST * * Pre-condition: * a createSymbolsTable() call must has been done * the finalizeSymbolsTable may not has been called * the AST may not has been finalized */ void addDeclaration(AstNode *declarationNode); /** * Search into the symbols table for a declaration of a given AST node for the current scope. * If no backward declaration exists, the program exits with an error message * * pre-conditions: * currentNode argument may not be NULL * currentNode must be an ID or a function call * a createSymbolsTable() call must has been done * the finalizeSymbolsTable may not has been called * the AST may not has been finalized * the enterScope() and exitScope() must have been called at the right time to be into the current scope * * returns: AST declaration node for the current scope */ AstNode* getDeclaration(AstNode *currentNode); /** * Returns the memory location of the last declaration, or INITIAL_INT on error */ int getDeclarationsMemoryUpperBound(); /** * Returns the memory location of the given node declaration, or INITIAL_INT on error */ int getDeclarationMemoryLocation(AstNode *node); #endif
Structure et Fichiers du projet
Afficher/masquer...Icône | Nom | Taille | Modification |
Pas de sous-répertoires. | |||
Icône | Nom | Taille | Modification |
| _ | Répertoire parent | 0 octets | 1731605914 14/11/2024 18:38:34 |
Warning
Ce code présente une manière possible d'implémenter un compilateur, et certains choix peuvent être discutés.Cependant, il peut donner des pistes pour démarrer, ou approcher certains concepts, et je tenterais par la suite de mettre à jour le code.
Utilisation de l'explorateur de code
- Navigation :
- Un clic sur une icône de répertoire ouvre ce répertoire pour en afficher les fichiers.
- Lorsque le répertoire en cours ne contient pas de sous-répertoires il est possible de remonter vers le répertoire parent.
- La structure de répertoires en treetable (tableau en forme d'arborescence) n'est plus possibledans cette version.
- Un clic sur une icône de fichier ouvre ce fichier pour en afficher le code avec la coloration syntaxique adaptée en fonction du langage principal utilisé dans le fichier.
- Affichage :
- Il est possible de trier les répertoires ou les fichiers selon certains critères (nom, taille, date).
- Actions :
- Les actions possible sur les fichiers dépendent de vos droits d'utilisateur sur le site. Veuillez activer le mode utilisateur pour activer les actions.
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 07/03/2010, last modified the 28/10/2018
Source of the printed document:https://www.gaudry.be/en/langages-lsd10-source-rf-project/source/symbolsTable.h.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
- ↑a,b LSD010 : Langage Simple et Didactique Il existe une un certain nombre d'interprétations de l'acronyme LSD (Langage Symbolique Didactique, Langage Sans Difficulté, Langage Simple et Didactique). LSD010 est la version 2010 de la suite LSD80, LSD_02, LSD03, LSD04, LSD05, LSD06, LSD07, LSD08, et LSD09.
References
- IHDCB332 - Théorie des langages : Syntaxe et sémantique : PY Schobbens,
Syntaxe et sémantique
(January 2010)
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.