summaryrefslogtreecommitdiff
path: root/tools/d2c/syntax/grammar.y
diff options
context:
space:
mode:
Diffstat (limited to 'tools/d2c/syntax/grammar.y')
-rw-r--r--tools/d2c/syntax/grammar.y109
1 files changed, 0 insertions, 109 deletions
diff --git a/tools/d2c/syntax/grammar.y b/tools/d2c/syntax/grammar.y
deleted file mode 100644
index 3952b9a..0000000
--- a/tools/d2c/syntax/grammar.y
+++ /dev/null
@@ -1,109 +0,0 @@
-
-%{
-
-#include "tokens.h"
-
-
-/* Affiche un message d'erreur suite à l'analyse en échec. */
-static int yyerror(asm_syntax *, char *);
-
-%}
-
-
-%code requires {
-
-#include "decl.h"
-
-}
-
-
-%union {
-
- char *string; /* Chaîne de caractères */
-
-}
-
-
-%define api.pure full
-
-%parse-param { asm_syntax *syntax }
-
-%code provides {
-
-#define YY_DECL \
- int syntax_lex(YYSTYPE *yylvalp)
-
-YY_DECL;
-
-}
-
-
-%token OPERAND_NAME OPERAND_INTERNAL OPERAND_VISIBLE
-
-%type <string> OPERAND_NAME OPERAND_INTERNAL OPERAND_VISIBLE
-
-
-%%
-
-
-operands : /* empty */
- | operands OPERAND_NAME { register_syntax_item(syntax, $2, SIT_KEYWORD); }
- | operands OPERAND_INTERNAL { register_syntax_item(syntax, $2, SIT_INT_OPERAND); }
- | operands OPERAND_VISIBLE { register_syntax_item(syntax, $2, SIT_EXT_OPERAND); }
-
-
-%%
-
-
-/******************************************************************************
-* *
-* Paramètres : syntax = structure impliquée dans le processus. *
-* msg = message d'erreur. *
-* *
-* Description : Affiche un message d'erreur suite à l'analyse en échec. *
-* *
-* Retour : 0 *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static int yyerror(asm_syntax *syntax, char *msg)
-{
- printf("syntax yyerror line %d: %s\n", yyget_lineno(), msg);
-
- return 0;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : syntax = structure à constituer à partir de données lues. *
-* raw = données brutes à analyser. *
-* *
-* Description : Interprête des données liées à une définition de syntaxe. *
-* *
-* Retour : true si l'opération s'est bien déroulée, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool load_syntax_from_raw_line(asm_syntax *syntax, const char *raw)
-{
- bool result; /* Bilan à faire remonter */
- YY_BUFFER_STATE state; /* Support d'analyse */
- int status; /* Bilan de l'analyse */
-
- state = yy_scan_string(raw);
-
- status = yyparse(syntax);
-
- result = (status == 0);
-
- yy_delete_buffer(state);
-
- return result;
-
-}