cwbaker / lalr

LALR(1) parser for C++
MIT License
78 stars 11 forks source link

Reduce memory usage #33

Closed cwbaker closed 1 year ago

cwbaker commented 1 year ago

Reduce memory usage by removing vector of symbols from GrammarSymbolSet and only generating labels for Graphviz DOT graphs not when generating parse tables that don't use labels.

mingodad commented 1 year ago

Still missing pthread:

------------------ src/lalr/lalr_examples/lalr_examples.forge ------------------
index 6aed8b3..0328435 100644
@@ -6,20 +6,21 @@ for _, cc in toolsets('^cc.*') do

     local lalr_examples = cc:Executable '${bin}/lalr_examples' {
         '${lib}/lalr_${platform}_${architecture}';
+   libraries = {"pthread"};
         cc:Cxx '${obj}/%1' {
             "lalr_examples.cpp",
             "lalr_error_handling_calculator_example.cpp",
             "lalr_hello_world_example.cpp",
             "lalr_json_example.cpp",
             "lalr_calculator_example.cpp",
-            "lalr_xml_example.cpp"        
+            "lalr_xml_example.cpp"
         };
     };

     -- If the Lalrc target prototype has been defined then use it to rebuild
     -- the example parse tables from grammars.  Otherwise just use the source
     -- files directly.
-    if cc.Lalrc then 
+    if cc.Lalrc then
         lalr_examples {
             cc:Cxx '${obj}/%1' {
                 cc:Lalrc '${obj}/%1.cpp' {

---------------------- src/lalr/lalr_test/lalr_test.forge ----------------------
index ff4e1e4..d2c241e 100644
@@ -4,6 +4,7 @@ for _, cc in toolsets('^cc.*') do
         cc:Executable '${bin}/lalr_test' {
             '${lib}/lalr_${platform}_${architecture}';
             '${lib}/UnitTest++_${platform}_${architecture}';
+       libraries = {"pthread"};

             cc:Cxx '${obj}/%1' {
                 'main.cpp',
-------------------------- src/lalr/lalrc/lalrc.forge --------------------------
index bdab5a3..d2eddd2 100644
@@ -1,8 +1,9 @@

-for _, cc in toolsets('^cc.*') do    
+for _, cc in toolsets('^cc.*') do
     cc:all {
         cc:Executable '${bin}/lalrc' {
             '${lib}/lalr_${platform}_${architecture}';
+       libraries = {"pthread"};
             cc:Cxx '${obj}/%1' {
                 'dot.cpp';
                 'lalrc.cpp';