From cde29e161649ce618a5cdd2dacfa43ac2b2c9dea Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Wed, 4 Oct 2017 15:46:57 +0200 Subject: [PATCH] add limit line to 1000 chars in rte gens --- DEVELOPER_NOTES | 2 ++ examples2/rte/gen_rte1.py | 7 +++++++ examples2/rte/gen_rte2.py | 8 ++++++++ examples2/rte/gen_rte3.py | 8 ++++++++ examples2/rte/gen_rte4.py | 8 ++++++++ examples2/rte/gen_rte5.py | 8 ++++++++ examples2/rte/gen_rte6.py | 8 ++++++++ examples2/rte/gen_rte7.py | 8 ++++++++ examples2/rte/gen_rte8.py | 8 ++++++++ examples2/rte/gen_rte9.py | 8 ++++++++ tests.glushkovrte.sh | 4 +++- 11 files changed, 76 insertions(+), 1 deletion(-) diff --git a/DEVELOPER_NOTES b/DEVELOPER_NOTES index 746bc65e80..a7d9e679e0 100644 --- a/DEVELOPER_NOTES +++ b/DEVELOPER_NOTES @@ -1,2 +1,4 @@ the top of the pushdown store: the top of the pushdown store is on the left meaning that transition function (r, xyz) \in (q, 0, abc) will pop symbol a first than symbol b and then symbol c, push symbol z then symbol y and finally symbol x. The typical representation is a vector of symbols so for the pop part forward iterators begin and end should be used and for the push part reversed iterators rbegin and rend should be used. This is very much similar to grammars where context free grammars generating a string or a sentential from a rules say A -> aBb| c product a^ncb^n. First b is pushed then B and finally a. + +String parsers cannot process correctly text files with more than 4096 characters on a single line at least on some systems. There is a bug in unget and putback function on istream. diff --git a/examples2/rte/gen_rte1.py b/examples2/rte/gen_rte1.py index 673b31fa83..fb17d1948d 100755 --- a/examples2/rte/gen_rte1.py +++ b/examples2/rte/gen_rte1.py @@ -3,10 +3,17 @@ import random import sys MAXD = 200 +MAXL = 1000 +L = 0 def p(c): print(c, end='') + global L + L = L + 1 + if L > MAXL: + L = 0 + print ("\n", end='') def SCont(depth): if depth > MAXD or random.randint(0,1) == 0: diff --git a/examples2/rte/gen_rte2.py b/examples2/rte/gen_rte2.py index 87e0169d41..73e9bd886d 100755 --- a/examples2/rte/gen_rte2.py +++ b/examples2/rte/gen_rte2.py @@ -3,9 +3,17 @@ import random import sys MAXD = 200 +MAXL = 1000 +L = 0 def p(c): print(c, end='') + global L + L = L + 1 + + if L > MAXL: + L = 0 + print ("\n", end='') if __name__ == '__main__': diff --git a/examples2/rte/gen_rte3.py b/examples2/rte/gen_rte3.py index aed186b972..1a02c48f4a 100755 --- a/examples2/rte/gen_rte3.py +++ b/examples2/rte/gen_rte3.py @@ -3,9 +3,17 @@ import random import sys MAXD = 200 +MAXL = 1000 +L = 0 def p(c): print(c, end='') + global L + L = L + 1 + + if L > MAXL: + L = 0 + print ("\n", end='') def S(depth): diff --git a/examples2/rte/gen_rte4.py b/examples2/rte/gen_rte4.py index 6f7ad63425..aa59556f51 100755 --- a/examples2/rte/gen_rte4.py +++ b/examples2/rte/gen_rte4.py @@ -3,9 +3,17 @@ import random import sys MAXD = 200 +MAXL = 1000 +L = 0 def p(c): print(c, end='') + global L + L = L + 1 + + if L > MAXL: + L = 0 + print ("\n", end='') def S(depth): diff --git a/examples2/rte/gen_rte5.py b/examples2/rte/gen_rte5.py index 4bac916213..0605fff3eb 100755 --- a/examples2/rte/gen_rte5.py +++ b/examples2/rte/gen_rte5.py @@ -3,9 +3,17 @@ import random import sys MAXD = 200 +MAXL = 1000 +L = 0 def p(c): print(c, end='') + global L + L = L + 1 + + if L > MAXL: + L = 0 + print ("\n", end='') if __name__ == '__main__': diff --git a/examples2/rte/gen_rte6.py b/examples2/rte/gen_rte6.py index c85aa5fde9..59602d8c1d 100755 --- a/examples2/rte/gen_rte6.py +++ b/examples2/rte/gen_rte6.py @@ -3,9 +3,17 @@ import random import sys MAXD = 200 +MAXL = 1000 +L = 0 def p(c): print(c, end='') + global L + L = L + 1 + + if L > MAXL: + L = 0 + print ("\n", end='') def SL(depth): diff --git a/examples2/rte/gen_rte7.py b/examples2/rte/gen_rte7.py index a7d965cdc6..1830cf6bf4 100755 --- a/examples2/rte/gen_rte7.py +++ b/examples2/rte/gen_rte7.py @@ -3,9 +3,17 @@ import random import sys MAXD = 200 +MAXL = 1000 +L = 0 def p(c): print(c, end='') + global L + L = L + 1 + + if L > MAXL: + L = 0 + print ("\n", end='') def SCont(depth): diff --git a/examples2/rte/gen_rte8.py b/examples2/rte/gen_rte8.py index c2e313e8c8..86571356a6 100755 --- a/examples2/rte/gen_rte8.py +++ b/examples2/rte/gen_rte8.py @@ -3,9 +3,17 @@ import random import sys MAXD = 200 +MAXL = 1000 +L = 0 def p(c): print(c, end='') + global L + L = L + 1 + + if L > MAXL: + L = 0 + print ("\n", end='') def S(depth): diff --git a/examples2/rte/gen_rte9.py b/examples2/rte/gen_rte9.py index e1e2f209b3..164d37d39e 100755 --- a/examples2/rte/gen_rte9.py +++ b/examples2/rte/gen_rte9.py @@ -3,9 +3,17 @@ import random import sys MAXD = 200 +MAXL = 1000 +L = 0 def p(c): print(c, end='') + global L + L = L + 1 + + if L > MAXL: + L = 0 + print ("\n", end='') def S(depth): diff --git a/tests.glushkovrte.sh b/tests.glushkovrte.sh index 325ecb35f7..33bfcc3473 100755 --- a/tests.glushkovrte.sh +++ b/tests.glushkovrte.sh @@ -47,6 +47,8 @@ function log { cat $2 >> $LOGFILE echo "rte: " >> $LOGFILE cat $3 >> $LOGFILE + echo "out: " >> $LOGFILE + echo $4 >> $LOGFILE } # $1 = genfile @@ -64,7 +66,7 @@ function runAcceptTest { fi if [ $RET != 0 ]; then # fail - log "$PATTERN" "$2" "$3" + log "$PATTERN" "$2" "$3" "$OUT" echo -n "" fi -- GitLab