From 31efd1691630bcfb0edaa4934e6a6c668bccb51d Mon Sep 17 00:00:00 2001 From: kaashoek Date: Fri, 15 Jan 1988 15:57:35 +0000 Subject: [PATCH] Comments added --- util/ceg/as_parser/pars.g | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/util/ceg/as_parser/pars.g b/util/ceg/as_parser/pars.g index 81f0ac778..5a9e2de2d 100644 --- a/util/ceg/as_parser/pars.g +++ b/util/ceg/as_parser/pars.g @@ -1,3 +1,42 @@ +/* This file contains the description of the 'as_table' parser. + * It transforms every entry into a C-funtion, for example : + * + * and dst:REG, src:EADDR ==> @text1( 0x23); + * mod_RM( dst->reg, src). + * + * ... dst:ACCU, src:DATA ==> @text1( 0x25); + * @text2( + * %$(src->expr)). + * + * Will be transformed into : + * + * and_instr( dst, src) + * struct t_operand *dst, *src; + * { + * if ( REG( dst) && EADDR( src)) { + * cur_pos += 1; + * fprint( outfile, "text1( 0x23)"); + * fprint( outfile, ";"); + * mod_RM( dst->reg, src); + * } + * else if ( ACCU( dst) && DATA( src)) { + * cur_pos += 1; + * fprint( outfile, "text1( 0x25)"); + * fprint( outfile, ";"); + * cur_pos += 2; + * fprint( outfile, "text2( "); + * eval( src->expr); + * fprint( outfile, ")"); + * fprint( outfile, ";"); + * } + * else + * error( "No match for and"); + * } + * + * At the end of the table a list is generated enumerating all the assembler + * mnemonics and their corresponding function names. + */ + { #include "decl.h" @@ -57,6 +96,10 @@ action : if_statement | subroutine ; +/* A function call is just an identifier followed by an expression surrounded + * by '(' and ')'. CONDITION is a token that matches this construct; + */ + subroutine : IDENTIFIER { yymorfg=1;} CONDITION { pr_subroutine( yytext);} ; -- 2.34.1