Support for anonymous directly represented variables.
authoretisserant
Fri, 28 Sep 2007 07:44:45 +0200
changeset 62 7955adc445b8
parent 61 3d52215b5e30
child 63 42f0e28a2399
Support for anonymous directly represented variables.
stage4/generate_cc/generate_cc_il.cc
stage4/generate_cc/generate_cc_st.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) */
 /****************************************/
--- 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) */
 /***************************************/