Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
230 commits
Select commit Hold shift + click to select a range
d3fbbbb
add outside subdir
sjanssen2 Mar 7, 2023
2e17ec2
set up test suite for outside
sjanssen2 Mar 7, 2023
8fbe380
activate outside mode
sjanssen2 Mar 7, 2023
f0d55ae
add first semantic check: can empty words be parsed
sjanssen2 Mar 7, 2023
0b0091e
activate tests
sjanssen2 Mar 7, 2023
80be2bc
adding new souce file
sjanssen2 Mar 7, 2023
2dafa78
linting
sjanssen2 Mar 7, 2023
04f04b3
added header guard
sjanssen2 Mar 7, 2023
f0231da
adding a test for user input NTs
sjanssen2 Mar 7, 2023
470d36e
skip test if no outside was requested at all
sjanssen2 Mar 8, 2023
4d88388
new semantic check for mixed types
sjanssen2 Mar 8, 2023
b72ea45
fct to check for being terminal or not
sjanssen2 Mar 8, 2023
57b455d
Merge branch 'master' of github.com:jlab/gapc into outside
sjanssen2 Mar 8, 2023
af3ab16
logic bug
sjanssen2 Mar 8, 2023
47c3a4d
reactivate resolve_blocks test
sjanssen2 Mar 10, 2023
691ff7c
add functionallity to resolve Alt::Blocks in given grammar
sjanssen2 Mar 11, 2023
bc8d32d
linter
sjanssen2 Mar 11, 2023
24bfb49
better name
sjanssen2 Mar 11, 2023
d82a8e8
add "resove blocks" test
sjanssen2 Mar 11, 2023
c4d7c52
added nil(EMPTY) back in
sjanssen2 Mar 11, 2023
12bb493
Merge branch 'master' of github.com:jlab/gapc into outside
sjanssen2 Mar 11, 2023
e696d78
cleanup
sjanssen2 Mar 11, 2023
f77dbff
intermediate state
sjanssen2 Mar 12, 2023
31574fa
intermediate: outside rules present, axiom missing, complete track mi…
sjanssen2 Mar 12, 2023
7f6918d
inject new axioms + transition to inside
sjanssen2 Mar 13, 2023
7a214b9
allow table_dim re-computation
sjanssen2 Mar 13, 2023
37c8a39
add modtest: complete grammar transformation
sjanssen2 Mar 13, 2023
6661689
use correct version
sjanssen2 Mar 13, 2023
aa36abd
add new test that checks for grammar topology
sjanssen2 Mar 13, 2023
5f8a6ce
Visitor: add a visit at the end of traversing a grammar
sjanssen2 Mar 13, 2023
640bef3
refactor
sjanssen2 Mar 13, 2023
e138ac2
use new function name
sjanssen2 Mar 14, 2023
cf15380
WIP
sjanssen2 Mar 14, 2023
4fda86f
linting
sjanssen2 Mar 14, 2023
0491ae4
added comments, seems to work
sjanssen2 Mar 14, 2023
aa3332e
linting
sjanssen2 Mar 14, 2023
2940fbd
Merge branch 'master' into outside
sjanssen2 Mar 15, 2023
b6a1642
Merge branch 'master' into outside
sjanssen2 Apr 12, 2023
4415701
Update plot_grammar.cc
sjanssen2 Apr 12, 2023
7f60b36
initialize startNode
sjanssen2 Apr 12, 2023
fe4dbd4
Merge branch 'master' of github.com:jlab/gapc into outside
sjanssen2 Apr 12, 2023
5f28eb0
Merge branch 'outside' of github.com:jlab/gapc into outside
sjanssen2 Apr 12, 2023
ea2acf8
Merge branch 'master' into outside
sjanssen2 Apr 12, 2023
daa07e9
adding a new private bool attribute to indicate grammar components to…
sjanssen2 Apr 13, 2023
3f3c9e7
only warn about user defined non-terminals, but not automatically inj…
sjanssen2 Apr 13, 2023
5d4c99d
initially, only set link names then later initialize alt::link.nt via…
sjanssen2 Apr 13, 2023
c4b92cb
linting
sjanssen2 Apr 13, 2023
57add94
set track
sjanssen2 Apr 18, 2023
a98aa99
add _is_outside_inside_transition function
sjanssen2 Apr 18, 2023
7429b99
indices for terminals / non-terminals
sjanssen2 Apr 18, 2023
342821a
initialize yield sizes for outside->inside transition
sjanssen2 Apr 18, 2023
f37ed54
carry over nt parameters from inside lhs NT to outside rhs NT call
sjanssen2 Apr 19, 2023
e560f2d
Merge branch 'outside' of github.com:jlab/gapc into outside_indices
sjanssen2 Apr 19, 2023
06460b5
clean up *.o *.d and binaries for outside tests
sjanssen2 Apr 19, 2023
c27eeb3
Merge branch 'outside' of github.com:jlab/gapc into outside_indices
sjanssen2 Apr 19, 2023
0464e54
a dirty version that gives indices for all elements of mini_twoLevelIL
sjanssen2 Apr 19, 2023
9f24657
don't sum via nullptr + fallback to left/right of NT when linking to …
sjanssen2 Apr 19, 2023
b61f18e
pass fallback left/right
sjanssen2 Apr 19, 2023
b1b069d
deal with ntargs
sjanssen2 Apr 20, 2023
5d7b146
we need an additional visitor for Fn_Arg, namely AFTER this node has …
sjanssen2 Apr 20, 2023
adfbf22
adding a doc string
sjanssen2 Apr 20, 2023
b4c9722
no moving boundary left + visit Fn_Arg AFTER subtree has been visited
sjanssen2 Apr 20, 2023
4bb5e1a
don't clone but create fresh axiom NT to avoid wrong table dimensions
sjanssen2 Apr 20, 2023
899c02d
also index parameterized terminals + constant terminals
sjanssen2 Apr 21, 2023
66e602a
Merge branch 'flag_const_inject_terminal_args' into outside_indices
sjanssen2 Apr 21, 2023
75f2555
adding next test from outside_looporder
sjanssen2 Apr 21, 2023
0cc4169
need to call the function of the base class, as otherwise Fn_Arg woul…
sjanssen2 Apr 21, 2023
64cce1f
integrating Alt::Multi, which is complicated by the fact that single …
sjanssen2 Apr 21, 2023
d307357
Merge branch 'master' of github.com:jlab/gapc into outside_indices
sjanssen2 Apr 25, 2023
ca075bd
clean up
sjanssen2 Apr 25, 2023
bb6efbf
Merge branch 'master' into outside
sjanssen2 Apr 26, 2023
1b03bd5
switch to cleaner method
sjanssen2 Apr 26, 2023
92c2797
define header for outside_init_indices
sjanssen2 Apr 26, 2023
62fda51
function headers for outside_init_indices
sjanssen2 Apr 26, 2023
6e38ec1
clean methods to compute indices for outside grammar components
sjanssen2 Apr 26, 2023
fcf3d52
revert visibility back to protected for left/right_indices
sjanssen2 Apr 26, 2023
eba15f8
newline
sjanssen2 Apr 26, 2023
094e724
Merge branch 'master' of github.com:jlab/gapc into outside
sjanssen2 Apr 26, 2023
06f7e31
Merge branch 'outside' of github.com:jlab/gapc into outside
sjanssen2 Apr 26, 2023
8e48a15
Merge branch 'outside' of github.com:jlab/gapc into outside_indices_c…
sjanssen2 Apr 26, 2023
6b2489e
Merge branch 'outside' of github.com:jlab/gapc into outside_indices_c…
sjanssen2 Apr 26, 2023
7ce5750
DRY: function next_index_var
sjanssen2 Apr 27, 2023
c0c6b47
propagate loops member
sjanssen2 Apr 27, 2023
5f0404d
reverse order in which right parsers are traversed and flip YS operat…
sjanssen2 Apr 27, 2023
47de9bd
linting
sjanssen2 Apr 27, 2023
35a3e1c
adding a warning IF user defined manual index overlay AND outside gra…
sjanssen2 Apr 27, 2023
7647b06
remove TODO
sjanssen2 Apr 27, 2023
0e885e1
adding extensive debugging output (must be removed later) + fixed for…
sjanssen2 Apr 28, 2023
33e655f
also initialize indices for Fn_Arg::Alt that lead to outside NT
sjanssen2 Apr 28, 2023
e6b3920
add complete_track filter
sjanssen2 Apr 28, 2023
f11bad4
make function accessible from outside
sjanssen2 Apr 28, 2023
1a25dc3
store left/right most variable names at nonterminal for guard constru…
sjanssen2 Apr 28, 2023
922ad46
create and add guards for outside NTs
sjanssen2 Apr 28, 2023
34d4acc
linting
sjanssen2 Apr 28, 2023
bc962b8
add the new statement "CustomeCode" to simply "print" an arbitary str…
sjanssen2 May 1, 2023
56d28bb
report_nts instead of just printing answers if outside mode was reque…
sjanssen2 May 1, 2023
0d1699d
always store left/right most index names for NTs (not only for outsid…
sjanssen2 May 1, 2023
57c07cb
collect user provided list of NTs which shall be reported
sjanssen2 May 1, 2023
62dcc29
add code to generate function that reports outside results
sjanssen2 May 1, 2023
73e8937
remove :
sjanssen2 May 2, 2023
b32329e
no outside guards if innermost NT is NOT an outside one
sjanssen2 May 2, 2023
0320608
move includes to header file
sjanssen2 May 2, 2023
6d90453
move function definition for Alt::Simple::init_outside_guards into ou…
sjanssen2 May 2, 2023
3527930
add two outside mod tests
sjanssen2 May 2, 2023
c4d5f4e
new test
sjanssen2 May 2, 2023
af54a46
revert change
sjanssen2 May 2, 2023
9e0059e
linting
sjanssen2 May 2, 2023
c12b26c
Merge pull request #202 from jlab/outside_indices_clean
sjanssen2 May 2, 2023
da8ab0e
fixed position of keyword "const"
sjanssen2 May 4, 2023
a917335
adding iloopSumMax filter for regression tests
sjanssen2 May 4, 2023
154ca0e
only add outside guards if a) index and outmost index are not identic…
sjanssen2 May 4, 2023
1eb5147
store original yield size of inside grammar for outside components fo…
sjanssen2 May 4, 2023
e597301
allow correct yield size re-analysis + inform Alt::Simple about their…
sjanssen2 May 4, 2023
3b14cb2
only add outside guards if a) index and outmost index are not identic…
sjanssen2 May 4, 2023
e38954c
start adding regression tests
sjanssen2 May 4, 2023
26d14ea
Merge branch 'outside_indices_clean' into outside
sjanssen2 May 4, 2023
691a96b
handle constant tables
sjanssen2 May 4, 2023
57a2035
linting
sjanssen2 May 4, 2023
6200502
activate test
sjanssen2 May 4, 2023
85748ec
add new grammar
sjanssen2 May 4, 2023
6c0f857
add function to execute two track tests
sjanssen2 May 4, 2023
85d2caf
test against branch outside_v2
sjanssen2 May 4, 2023
5c72722
fix case destinction for outside guard initialization
sjanssen2 May 4, 2023
5bfb8bb
fix return type
sjanssen2 May 4, 2023
7f7e6a2
add external functions for tests
sjanssen2 May 4, 2023
fea16c4
add more tests
sjanssen2 May 4, 2023
42b1acd
activate more tests
sjanssen2 May 4, 2023
229f684
adding more filters for example grammars
sjanssen2 May 4, 2023
a7afbed
add missing header file
sjanssen2 May 5, 2023
cb29c44
activate first CYK test
sjanssen2 May 5, 2023
a7967cf
first version to generate CYK code (not yet for openMP nor outside)
sjanssen2 May 5, 2023
6ad9ed6
add checkpointing
sjanssen2 May 5, 2023
e8cb6f7
allow for decrements
sjanssen2 May 5, 2023
0c1b856
also allow -- not only ++ in For
sjanssen2 May 5, 2023
b9327d1
CYK should now also produce openMP code
sjanssen2 May 5, 2023
8f333f2
reduce to only 5 randomly selected NTs to keep truth file small
sjanssen2 May 5, 2023
ca28d8f
Merge pull request #203 from jlab/outside_reduceTMHMM
sjanssen2 May 5, 2023
4e4130e
Merge branch 'outside' of github.com:jlab/gapc into outside
sjanssen2 May 5, 2023
59d436d
add checkpointing
sjanssen2 May 9, 2023
9f5260c
Merge branch 'refactor_cyk_multiloops' of github.com:jlab/gapc into o…
sjanssen2 May 16, 2023
1959555
avoid duplicate definition
sjanssen2 May 17, 2023
7f3ce68
Merge branch 'refactor_cyk_multiloops' of github.com:jlab/gapc into o…
sjanssen2 May 17, 2023
cfb3552
remove CYK old fashioned stub
sjanssen2 May 17, 2023
a97d861
Merge branch 'outside' of github.com:jlab/gapc into outside_cyk
sjanssen2 May 17, 2023
8e045dc
merge
sjanssen2 May 17, 2023
252da39
Merge branch 'refactor_cyk_multiloops' of github.com:jlab/gapc into o…
sjanssen2 May 17, 2023
18c3008
intermedite state
sjanssen2 May 18, 2023
427eb7a
Merge branch 'master' of github.com:jlab/gapc into outside
sjanssen2 May 18, 2023
afb1d3b
clean up old Custom*e*Code use
sjanssen2 May 18, 2023
2024491
do not add loops onto inself, but replace to prevent infinit loops
sjanssen2 May 21, 2023
ebede34
add grammar that can parse the empty word to not fail semantic test
sjanssen2 May 21, 2023
0f571f2
1) only add for loops, if not already in list 2) consequently pass lo…
sjanssen2 May 21, 2023
c34f2c0
add test for which gapc was stuck in an infinit loop, because loop va…
sjanssen2 May 21, 2023
5c54679
Merge branch 'master' of github.com:jlab/gapc into outside_fix_infloop
sjanssen2 May 21, 2023
eaf58e1
use different branch of gapc-test-suite
sjanssen2 May 21, 2023
7a1fe29
Merge branch 'master' of github.com:jlab/gapc into outside
sjanssen2 May 21, 2023
9c9198c
Merge branch 'outside_fix_infloop' of github.com:jlab/gapc into outsi…
sjanssen2 May 21, 2023
eab1eab
fix pointer access
sjanssen2 May 22, 2023
10b8480
no CYK available yet
sjanssen2 May 22, 2023
d1ed712
Update c-cpp.yml
sjanssen2 May 22, 2023
daf1637
Merge branch 'outside' of github.com:jlab/gapc into outside_fix_infloop
sjanssen2 May 22, 2023
448099b
linting
sjanssen2 May 22, 2023
aa18180
passing iterators to sum_ys() led to wrong results only on OSx (ubunt…
sjanssen2 May 23, 2023
55689dd
there was no use of the passed track argument -> removed
sjanssen2 May 23, 2023
ab03062
Merge branch 'outside_fix_infloop' of github.com:jlab/gapc into outsi…
sjanssen2 May 23, 2023
bf82695
Merge branch 'fix_outside_osx_sumYS' of github.com:jlab/gapc into out…
sjanssen2 May 23, 2023
6660f76
Merge pull request #209 from jlab/fix_outside_osx_sumYS
sjanssen2 May 23, 2023
d7f5642
Merge branch 'outside' of github.com:jlab/gapc into outside_fix_infloop
sjanssen2 May 23, 2023
539758a
Merge branch 'outside' of github.com:jlab/gapc into outside_cyk
sjanssen2 May 23, 2023
90e96a1
get old tests back in
sjanssen2 May 23, 2023
eb0a1ea
Merge pull request #208 from jlab/outside_fix_infloop
sjanssen2 May 23, 2023
67bc1c0
extend CYK for outside by a checkpointing mechanism. We need addition…
sjanssen2 May 23, 2023
28cc255
when loading dumped checkpoint, start with indices +/- 1 to make sure…
sjanssen2 May 23, 2023
206077c
add tests for outside + cyk + checkpointing
sjanssen2 May 23, 2023
c6a0984
adding TODO
sjanssen2 May 23, 2023
2dfd3d0
linting and adding some comments to new outside traversal construction
sjanssen2 May 23, 2023
d46b86c
linting
sjanssen2 May 23, 2023
fcacc2d
pointing to the correct branch of gapc-test-suite
sjanssen2 May 24, 2023
b9d4ff0
adding CYK openMP code for outside
sjanssen2 May 24, 2023
ae0eb09
linting
sjanssen2 May 24, 2023
a405cda
enclose cond if used within one line
sjanssen2 May 26, 2023
6714d4c
fixing traversal order for openMP outside
sjanssen2 May 26, 2023
a12ba18
linting
sjanssen2 May 26, 2023
66008f3
handling for base case where input sequence is smaller than tile size
sjanssen2 May 26, 2023
c191d95
handle another set of CYK openMP indices for outside programs
sjanssen2 May 31, 2023
af20cfd
handle another set of CYK openMP indices for outside programs
sjanssen2 May 31, 2023
19587ca
unsuccessful attempt to add checkpointing to CYK openMP code generation
sjanssen2 May 31, 2023
4d64bc7
fix checkpointing + cyk + outside in single-thread case; multi-thread…
fymue Jun 6, 2023
f47e389
try to reproduce my issue in github actions
sjanssen2 Jun 7, 2023
5b6dad8
adding Fynn's commands
sjanssen2 Jun 7, 2023
14c94d8
use the freshly compiled (but not installed) gapc binary
sjanssen2 Jun 7, 2023
c96eb9f
set archiving interval to 1 sec in Fynn's tests
sjanssen2 Jun 10, 2023
9f91fcc
make OS work with openMP
sjanssen2 Jun 10, 2023
95b70d1
also add mac openmp flags in checkpointed openmp cyk program
fymue Jun 10, 2023
340b84c
don't declare thread as mutable (doesn't need to be)
fymue Jun 11, 2023
487f12b
lock mutex before prints to avoid interference between stdout and stderr
fymue Jun 11, 2023
5dd81b6
Merge pull request #215 from jlab/outside_cyk_openMPcheckpoint_issue
sjanssen2 Jun 12, 2023
2272361
no extra test
sjanssen2 Jun 12, 2023
01f502a
reference our elaborate github discussion of the std::cout issue
sjanssen2 Jun 12, 2023
8939311
Merge pull request #213 from jlab/outside_cyk_openMPcheckpoint
sjanssen2 Jun 12, 2023
5d9c8c8
clean up some old comments
sjanssen2 Jun 12, 2023
3e64f5e
Merge pull request #210 from jlab/outside_cyk
sjanssen2 Jun 12, 2023
c9bfc75
Merge branch 'master' into outside
sjanssen2 Jun 13, 2023
f2371f9
added missing type results for "is_terminal_type" function
sjanssen2 Jun 13, 2023
77afd35
completed TODO
sjanssen2 Jun 13, 2023
e39272a
test what happens if table dims are not re-setted in grammar_transfor…
sjanssen2 Jun 13, 2023
9bebbee
remove LOOPDEBUG prints and add documentation of the basic idea in mi…
sjanssen2 Jun 13, 2023
8f3d115
Merge branch 'test_outside_tabledim' of github.com:jlab/gapc into out…
sjanssen2 Jun 13, 2023
61da637
fixed "const fct(...)" --> "fct(...) const"
sjanssen2 Jun 14, 2023
06a688d
properly clean up object
sjanssen2 Jun 14, 2023
ef1be23
use const instead of hard coding ALL
sjanssen2 Jun 14, 2023
c1d398f
make it really a constant
sjanssen2 Jun 14, 2023
5249b7a
omit Type::Name check
sjanssen2 Jun 14, 2023
75df316
make const
sjanssen2 Jun 14, 2023
43de262
clean up report_nts
sjanssen2 Jun 14, 2023
d8be368
avoid memory leaks
sjanssen2 Jun 14, 2023
fb9d861
do not delete lhs_nt->name
sjanssen2 Jun 14, 2023
287028b
more elaborate explanation about complete_track filter
sjanssen2 Jun 17, 2023
8eabb33
better explanation
sjanssen2 Jun 18, 2023
f825f9d
fix typo
sjanssen2 Jun 18, 2023
86be424
add hint to plot-grammar
sjanssen2 Jun 18, 2023
f25951c
Merge branch 'master' into outside
sjanssen2 Jun 20, 2023
63bd6bf
increase test to avoid fails on OSx
sjanssen2 Jun 27, 2023
4d230d6
linting
sjanssen2 Jul 4, 2023
5cfa644
remove unused function
sjanssen2 Jul 4, 2023
a2c366e
linting
sjanssen2 Jul 4, 2023
681d312
remove unused algebra function
sjanssen2 Jul 4, 2023
524ced9
updating debian package
sjanssen2 Jul 5, 2023
84e1c61
also execute outside tests on OSX
sjanssen2 Jul 5, 2023
d974b11
merge outside mod tests into "normal" workflow
sjanssen2 Jul 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:

- name: test-mod
run: make test-mod TRUTH_DIR=$GITHUB_WORKSPACE/../gapc-test-suite/Truth TRUTH_SUFFIX=_ubuntu
- name: test-mod_outside
run: make -j 2 test-mod_outside TRUTH_DIR=$GITHUB_WORKSPACE/../gapc-test-suite/Truth TRUTH_SUFFIX=_ubuntu
- name: test-regress
run: make test-regress TRUTH_DIR=$GITHUB_WORKSPACE/../gapc-test-suite/Truth
- name: test-ambiguity
Expand Down Expand Up @@ -93,6 +95,8 @@ jobs:

- name: test-mod
run: make test-mod TRUTH_DIR=$GITHUB_WORKSPACE/../gapc-test-suite/Truth TRUTH_SUFFIX=_osx
- name: test-mod_outside
run: make -j 2 test-mod_outside TRUTH_DIR=$GITHUB_WORKSPACE/../gapc-test-suite/Truth TRUTH_SUFFIX=_osx
- name: test-regress
run: make test-regress TRUTH_DIR=$GITHUB_WORKSPACE/../gapc-test-suite/Truth
- name: test-ambiguity
Expand Down
15 changes: 12 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ CXXFILES = $(wildcard src/*.cc) \
$(wildcard src/util/*.cc) \
$(wildcard src/printer/*.cc) \
$(wildcard src/specialize_grammar/*.cc) \
$(wildcard src/outside/*.cc) \
$(UNITTEST_CXX) \
$(MODTESTS_CXX) \
$(MODOUTSIDETESTS_CXX) \
$(wildcard testdata/test/*.cc) \
rtlib/string.cc \

Expand Down Expand Up @@ -97,6 +99,7 @@ TEMP = $(GEN_CXXFILES) $(OFILES) $(DEPS)\
src/position.hh \
gapc \
$(MODTESTS) \
$(MODOUTSIDETESTS) \
stats testdata/modtest/stats.o \
src/version.txt src/version.cc src/version.d src/version.o \
testdata/config-tests/config.finished \
Expand Down Expand Up @@ -128,7 +131,7 @@ gapc: src/gapc.o $(MAIN_OBJ) src/version.o src/prefix.o

stats \
test_rt_tab \
multi_cyk multi_deps multi_indices multi_list_size multi_eliminate_lists_more multi_eliminate_lists multi_algebra multi_signature multi_rt_approx multi_rt_all multi_in_out multi_self_rec multi_calls multi_table_dim multi_max_filter multi_loops multi_ys parser: src/version.o src/prefix.o
multi_cyk multi_deps multi_indices multi_list_size multi_eliminate_lists_more multi_eliminate_lists multi_algebra multi_signature multi_rt_approx multi_rt_all multi_in_out multi_self_rec multi_calls multi_table_dim multi_max_filter multi_loops multi_ys parser outside_checksemantics outside_resolve_blocks outside_grammar outside_indices outside_loops: src/version.o src/prefix.o

backtrack: src/version.o

Expand Down Expand Up @@ -283,11 +286,13 @@ testdata/unittest/%: testdata/unittest/%.o

# modtest

MODTESTS_CXX:= $(wildcard testdata/modtest/*.cc)
MODTESTS_CXX:= $(wildcard testdata/modtest/multi*.cc)
MODOUTSIDETESTS_CXX:= $(wildcard testdata/modtest/outside*.cc)

MODTESTS:=$(sort $(subst testdata/modtest/,,$(MODTESTS_CXX:.cc=)))
MODOUTSIDETESTS:=$(sort $(subst testdata/modtest/,,$(MODOUTSIDETESTS_CXX:.cc=)))
modtests: $(MODTESTS)

outsidetests: $(MODOUTSIDETESTS)

# paraltest

Expand All @@ -307,6 +312,10 @@ test-mod: modtests
cd testdata/modtest &&\
$(SHELL) run.sh $(TRUTH_DIR)/Mod$(TRUTH_SUFFIX) $(MODTESTS)

test-mod_outside: outsidetests
cd testdata/modtest &&\
$(SHELL) run_outside.sh $(TRUTH_DIR)/Mod$(TRUTH_SUFFIX) $(MODOUTSIDETESTS)

gen-mod: modtests
cd testdata/modtest &&\
$(SHELL) gen.sh $(TRUTH_DIR)/Mod$(TRUTH_SUFFIX) $(MODTESTS)
Expand Down
301 changes: 301 additions & 0 deletions debian/changelog

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion debian/copyright
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ It was downloaded from:

Upstream Author(s):

Stefan Janssen <[email protected]>
Stefan Janssen <[email protected]>
Georg Sauthoff <[email protected]>

Copyright:
Expand Down
14 changes: 14 additions & 0 deletions rtlib/filter.hh
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,19 @@ inline bool samesize(const Basic_Sequence<a1, pos_type> &s1,
return j1-i1 == j2-i2;
}

/* The recursion basis for outside candidates is the empty parse via the inside
* part of the user provided grammar (won't work if user grammar cannot parse
* the empty word!). However, an empty word could in principle be parsed between
* every two characters of the input. To enforce that this only happens after
* the complete track (= input sequence) has been consumed via outside parts,
* we apply this filter at the transition between outside and inside grammar
* parts, i.e. only at location (n,n).
*/
template<typename alphabet, typename pos_type, typename T>
inline bool complete_track(
const Basic_Sequence<alphabet, pos_type> &seq, T i, T j) {
return ((i == seq.n) && (j == seq.n));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly is checked here?

}


#endif // RTLIB_FILTER_HH_
4 changes: 4 additions & 0 deletions rtlib/generic_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,12 @@ int main(int argc, char **argv) {

gapc::add_event("end_computation");

#ifndef OUTSIDE
std::cout << "Answer: \n";
obj.print_result(std::cout, res);
#else
obj.report_insideoutside(std::cout);
#endif

gapc::add_event("end_result_pp");

Expand Down
120 changes: 95 additions & 25 deletions src/alt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ Alt::Base *Alt::Simple::clone() {
i != args.end(); ++i) {
a->args.push_back((*i)->clone());
}
// necessary to construct correct guards for outside code generation
this->m_ys_inside = this->m_ys;
return a;
}

Expand Down Expand Up @@ -1068,25 +1070,58 @@ void Alt::Simple::reset() {
// by local ys-guards


Expr::Base *Alt::Simple::next_index_var(unsigned &k, size_t track,
Expr::Base *Alt::next_index_var(unsigned &k, size_t track,
Expr::Base *next_var, Expr::Base *last_var, Expr::Base *right,
const Yield::Size &ys, const Yield::Size &lhs, const Yield::Size &rhs) {
if (ys.low() != ys.high()) {
if (rhs.low() == rhs.high()) {
const Yield::Size &ys, const Yield::Size &lhs, const Yield::Size &rhs,
std::list<Statement::For*> &loops,
bool for_outside_generation, bool outmost, bool is_left_not_right) {
/* only for outside NTs:
* If left/right of the rhs outside NT are grammar components with at least
* one moving boundary, we need to start leftmost/rightmost with a new
* loop variable t_x_k.
* Note that empty grammar components might occur on left/rightmost positions
* like LOC. Once we encounter these components, we already did increase k
* previously. Thus, it is not sufficient to "just" look at lhs, ys and rhs.
*/
if (for_outside_generation &&
outmost &&
// nothing on the left, but moving boundary on the right
(((lhs.low() == 0) && (lhs.high() == 0) && (rhs.low() != rhs.high())) ||
// nothing on the right, but moving boundary on the left
((rhs.low() == 0) && (rhs.high() == 0) && (lhs.low() != lhs.high()))
)
) {
outmost = true;
} else {
outmost = false;
}

if ((ys.low() != ys.high()) || outmost) {
if ((rhs.low() == rhs.high()) && !outmost) {
return right;
} else {
std::ostringstream o;
o << "t_" << track << "_k_" << k;
k++;
Expr::Vacc *ivar = new Expr::Vacc(new std::string(o.str()));

assert(lhs.low() == lhs.high());
// start generating for-loop
assert((lhs.low() == lhs.high()) || outmost);
std::pair<Expr::Base*, Expr::Base*> index(0, 0);

Yield::Size lhs_ys(lhs);
lhs_ys += ys;

if (rhs.high() == Yield::UP) {
/* flip next/last variables for loops that belong to outside NTs and
* are right of the rhs outside NT, since we need to iterate towards the
* right end of the input sequence */
if (for_outside_generation && !is_left_not_right) {
Expr::Base* tmp = last_var;
last_var = right;
right = tmp;
}

if (outmost || (rhs.high() == Yield::UP)) {
index.first = last_var->plus(lhs_ys.low());
} else {
// e.g. second maxsize filter in grammar/forloops5
Expand All @@ -1101,7 +1136,7 @@ Expr::Base *Alt::Simple::next_index_var(unsigned &k, size_t track,

Expr::Base *cond = new Expr::Less_Eq(ivar, index.second);
// e.g. first maxsize filter in grammar/forloops5
if (lhs_ys.high() < Yield::UP) {
if ((lhs_ys.high() < Yield::UP) && !outmost) {
cond = new Expr::And(
cond, new Expr::Less_Eq (ivar, last_var->plus(lhs_ys.high())));
}
Expand All @@ -1110,6 +1145,7 @@ Expr::Base *Alt::Simple::next_index_var(unsigned &k, size_t track,
new ::Type::Size(), ivar, index.first);
Statement::For *f = new Statement::For (loopvariable, cond);
loops.push_back(f);

return ivar;
}
} else {
Expand Down Expand Up @@ -1141,7 +1177,8 @@ void Alt::Simple::init_indices(
rhs_ys += ys;

next_var = next_index_var(
k, track, next_var, last_var, right, ys, lhs, rhs);
k, track, next_var, last_var, right, ys, lhs, rhs,
this->loops, false, false, false);

std::pair<Expr::Base*, Expr::Base*> res(0, 0);
if (lhs.low() == lhs.high()) {
Expand Down Expand Up @@ -1510,6 +1547,9 @@ void Alt::Simple::init_guards() {
std::list<Expr::Base*> l;
assert(m_ys.tracks() == left_indices.size());
Yield::Multi::iterator k = m_ys.begin();
if (this->is_partof_outside()) {
k = m_ys_inside.begin();
}
std::vector<Expr::Base*>::iterator j = right_indices.begin();
for (std::vector<Expr::Base*>::iterator i = left_indices.begin();
i != left_indices.end(); ++i, ++j, ++k) {
Expand Down Expand Up @@ -1851,6 +1891,28 @@ std::list<Statement::Base*> *Alt::Simple::add_for_loops(
return stmts;
}

std::list<Statement::Base*> *Alt::Simple::add_guards(
std::list<Statement::Base*> *stmts, bool add_outside_guards) {
Statement::If *use_guards = guards;
if (add_outside_guards) {
use_guards = guards_outside;
}
if (use_guards) {
stmts->push_back(use_guards);
if (datatype->simple()->is(::Type::LIST)) {
// only call finalize on hash lists
if (!ret_decl->rhs && adp_specialization == ADP_Mode::STANDARD) {
Statement::Fn_Call *f = new Statement::Fn_Call(
Statement::Fn_Call::FINALIZE);
f->add_arg(*ret_decl);
stmts->push_back(f);
}
}
stmts = &use_guards->then;
}
return stmts;
}

void Alt::Simple::codegen(AST &ast) {
// std::cout << "-----------Simple IN" << std::endl;

Expand All @@ -1873,19 +1935,10 @@ void Alt::Simple::codegen(AST &ast) {


init_guards();
if (guards) {
stmts->push_back(guards);
if (datatype->simple()->is(::Type::LIST)) {
// only call finalize on hash lists
if (!ret_decl->rhs && adp_specialization == ADP_Mode::STANDARD) {
Statement::Fn_Call *f = new Statement::Fn_Call(
Statement::Fn_Call::FINALIZE);
f->add_arg(*ret_decl);
stmts->push_back(f);
}
}
stmts = &guards->then;
if (this->is_partof_outside()) {
init_outside_guards();
}
stmts = add_guards(stmts, this->is_partof_outside());

init_filter_guards(ast);

Expand Down Expand Up @@ -1925,11 +1978,21 @@ void Alt::Simple::codegen(AST &ast) {
}
}

// add filter_guards
stmts = add_filter_guards(stmts, filter_guards);
if (this->is_partof_outside()) {
// add for loops for moving boundaries
stmts = add_for_loops(stmts, loops, has_index_overlay());

// add for loops for moving boundaries
stmts = add_for_loops(stmts, loops, has_index_overlay());
stmts = add_guards(stmts, false);

// add filter_guards
stmts = add_filter_guards(stmts, filter_guards);
} else {
// add filter_guards
stmts = add_filter_guards(stmts, filter_guards);

// add for loops for moving boundaries
stmts = add_for_loops(stmts, loops, has_index_overlay());
}

add_subopt_guards(stmts, ast);

Expand Down Expand Up @@ -2510,7 +2573,14 @@ void Alt::Simple::init_multi_ys() {


void Alt::Link::init_multi_ys() {
m_ys = nt->multi_ys();
if (nt->is_partof_outside()) {
m_ys.set_tracks(tracks_);
for (Yield::Multi::iterator i = m_ys.begin(); i != m_ys.end(); ++i) {
*i = Yield::Size(0, Yield::UP);
}
} else {
m_ys = nt->multi_ys();
}
Base::init_multi_ys();
}

Expand Down
Loading