# HG changeset patch # User etisserant # Date 1190958285 -7200 # Node ID 7955adc445b87b155b35a3e1b9401f41e6d212b2 # Parent 3d52215b5e30c6a8cbd5df7aac9ad1433fb8db85 Support for anonymous directly represented variables. diff -r 3d52215b5e30 -r 7955adc445b8 stage4/generate_cc/generate_cc_il.cc --- a/stage4/generate_cc/generate_cc_il.cc Mon Sep 17 17:57:50 2007 +0200 +++ b/stage4/generate_cc/generate_cc_il.cc Fri Sep 28 07:44:45 2007 +0200 @@ -452,6 +452,22 @@ private: + +/********************************************/ +/* B.1.4.1 Directly Represented Variables */ +/********************************************/ +// direct_variable: direct_variable_token {$$ = new direct_variable_c($1);}; +void *visit(direct_variable_c *symbol) { + TRACE("direct_variable_c"); + /* Do not use print_token() as it will change everything into uppercase */ + if (strlen(symbol->value) == 0) ERROR; + s4o.print("*("); + this->print_variable_prefix(); + s4o.printlocation(symbol->value + 1); + s4o.print(")"); + return NULL; +} + /****************************************/ /* B.2 - Language IL (Instruction List) */ /****************************************/ diff -r 3d52215b5e30 -r 7955adc445b8 stage4/generate_cc/generate_cc_st.cc --- a/stage4/generate_cc/generate_cc_st.cc Mon Sep 17 17:57:50 2007 +0200 +++ b/stage4/generate_cc/generate_cc_st.cc Fri Sep 28 07:44:45 2007 +0200 @@ -142,6 +142,21 @@ return NULL; } +/********************************************/ +/* B.1.4.1 Directly Represented Variables */ +/********************************************/ +// direct_variable: direct_variable_token {$$ = new direct_variable_c($1);}; +void *visit(direct_variable_c *symbol) { + TRACE("direct_variable_c"); + /* Do not use print_token() as it will change everything into uppercase */ + if (strlen(symbol->value) == 0) ERROR; + s4o.print("*("); + this->print_variable_prefix(); + s4o.printlocation(symbol->value + 1); + s4o.print(")"); + return NULL; +} + /***************************************/ /* B.3 - Language ST (Structured Text) */ /***************************************/