How to Install LGen

Requirements

  • Lua version 5.2 or later.
    • The profileLua.sh script check first if you have a local file called ./lua that represents a link to the Lua executable.
    • If you don't have the ./lua link, the script will try to use the Lua in the path /usr/local/bin/lua.
    • Last, the script will try to use the SO environment Lua executable using the lua command.
    • You also can define the path to the Lua executable changing the variable lua inside the script at line 8.
  • LPeg version 0.12 or later.

Instructions

First, download and install Lua. If you already have Lua installed, find out which version you have and where it is installed.

Next, download the LGen last version. The LGen package is usually called LGen.xxx and is distributed as a tarball named LGen.xxx.tar.gz. Open this tarball with tar zxvf LGen.xxx.tar.gz command. This command will create two main directories, called Trans and GenEngine. Inside each of them, there is a folder bin, which will contain all executable files for each process. To test installation try these commands:

cd GenEngine/bin/
./profileLua.sh ../Examples/Est.BNFOnly_WCycle_01.lua 1 3

If you see output like this, the installation is complete.

Lua Path: lua
Lua Version: Lua 5.3.5  Copyright (C) 1994-2018 Lua.org, PUC-Rio
Generation without coverage criteria.
Default nice level (-20) is used.
/usr/bin/time -v -a -o ../Examples/Est.BNFOnly_WCycle_01.none.1.3.time lua RunGrammar.luac ../Examples/Est.BNFOnly_WCycle_01.lua 1 1 3 none ../Examples/Est.BNFOnly_WCycle_01.none.1.3
Runtime Options:
{[GrammarFile]="Examples/Est.BNFOnly_WCycle_01.lua", [coverageCrit]="none", [execMode]="gen", [filePrefix]="Examples/Est.BNFOnly_WCycle_01.none.1.3", [maxCycles]="1", [maxCyclesOp]="1", [maxDerivLen]="3", [quietExec]="false", [transGrammarCache]="false"}
Executing Sentences Generation:
Apply Grammar Transformations...
Applying the transformation: calcMinTreeHeight (Critical? false, with #G = 4) ...
Is over?    true
startSymbol:     ST
startSymbol prods. ids:    2    {'r5','r6'}
startSymbol Min:    2    {<'r5',2>; <'r6',2>}
The smallest tree has the height of: 2 (r5)
The max tree has the height of: 2 (r6)
Grammar was changed by transformation calcMinTreeHeight. #G now is 4
End of transformation calcMinTreeHeight. Exe. time 0.001154
Stating the Generation Process...
genCustom:runConf    {[GrammarFile]="Examples/Est.BNFOnly_WCycle_01.lua", [coverageCrit]="none", [execMode]="gen", [filePrefix]="Examples/Est.BNFOnly_WCycle_01.none.1.3", [maxCycles]="1", [maxCyclesOp]="1", [maxDerivLen]="3", [quietExec]="false", [transGrammarCache]="false"}
--------Starting Debug information-------
Debug useMStorage:    false
Debug useMinTSortAlts:    false
Debug useRandomAlts:    false
Debug useMinTSortNT:    true
Debug non_terminal:   time: 0.000061, global perc.: 11.423, count: 7 and use memoize: 0
Debug >>Decision      time: 0.000034, local  perc.: 55.738 and count: 7
Debug Seq:            time: 0.000022, global perc.: 4.120, count: 4 and use memoize: false
Debug Alt:            time: 0.000035, global perc.: 6.554, count: 5 and use memoize: 0
Debug >>Check Patt.   time: 0.000010, local  perc.: 28.571 and count: 5
Debug Terminal:       time: 0.000049, global perc.: 9.176, count: 8 and use memoize: false
Debug Kleene:         time: 0.000000, global perc.: 0.000, count: 0 and use memoize: false
Debug AllMeasurement: time: 0.000167 and global perc.: 31.273
Debug Total S. Processing : 0.000157 and global perc.: 29.401
Debug Total Gen.      time: 0.00053
Debug Gen.            rate: 7490.64 sent./time unit
Debug Gen. rate (Gen+Disc): 7490.64 sent./time unit
Debug NTExp Discard: 2, call perc.: 28.571
Debug Memory usage:  353.35 Kbytes
----------End Debug----------------------
Num. Sentences: 4
Highest Deriv. Tree: 3
Disc. Sentences: 0
MD5 out file: e632-a68f, e632f30c2c24b9f601a7841630e2a68f
RunGrammar have been finished!
Generated file: (Examples/Est.BNFOnly_WCycle_01.none.1.3.out,Examples/Est.BNFOnly_WCycle_01.none.1.3.prf, Examples/Est.BNFOnly_WCycle_01.none.1.3.time)
Nice: -20
---------------------------------
Uncovered nonterminals: 
{empty}
Uncovered terminals: 
nil
Uncovered productions: 
nil
===================================================================
NT Count: 3
NT Covered: 3
NTN Covered: 0
===================================================================
Coverage rate for NT. : 100.000
Coverage rate for Terminals. : 0.000
Coverage rate for Productions. : 0.000
Number of Sentences and Derivations: 4 - 4
Output checksum is: e632f30c2c24b9f601a7841630e2a68f
    Percent of CPU this job got: 80%
    Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.01
    Average shared text size (kbytes): 0
    Average unshared data size (kbytes): 0
    Average stack size (kbytes): 0
    Average total size (kbytes): 0
    Maximum resident set size (kbytes): 4444
    Average resident set size (kbytes): 0
    Major (requiring I/O) page faults: 0
    Minor (reclaiming a frame) page faults: 737
    Voluntary context switches: 8
    Involuntary context switches: 5
    Swaps: 0
    File system inputs: 0
    File system outputs: 48
    Socket messages sent: 0
    Socket messages received: 0
    Signals delivered: 0
    Page size (bytes): 4096
    Exit status: 0
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License