From 47e5e8c9663c35495419ae59ab4d1cd9709ec0e2 Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Sat, 18 Feb 2012 16:22:40 +0000 Subject: libpgf: now the linearization index is created during the grammar loading which also makes the types PgfLzr and PgfParser redundant. --- src/runtime/c/utils/pgf-translate.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src/runtime/c/utils') diff --git a/src/runtime/c/utils/pgf-translate.c b/src/runtime/c/utils/pgf-translate.c index 7837d3831..6d0a8804d 100644 --- a/src/runtime/c/utils/pgf-translate.c +++ b/src/runtime/c/utils/pgf-translate.c @@ -68,12 +68,6 @@ int main(int argc, char* argv[]) { goto fail_concr; } - // Create the parser for the source category - PgfParser* parser = pgf_new_parser(from_concr, pool); - - // Create a linearizer for the destination category - PgfLzr* lzr = pgf_new_lzr(to_concr, pool); - // Arbitrarily choose linearization index 0. Usually the initial // categories we are interested in only have one field. int lin_idx = 0; @@ -110,7 +104,7 @@ int main(int argc, char* argv[]) { // Begin parsing a sentence of the specified category PgfParse* parse = - pgf_parser_parse(parser, cat, lin_idx, pool); + pgf_parser_parse(from_concr, cat, lin_idx, pool); if (parse == NULL) { fprintf(stderr, "Couldn't begin parsing\n"); status = EXIT_FAILURE; @@ -149,7 +143,7 @@ int main(int argc, char* argv[]) { // Enumerate the concrete syntax trees corresponding // to the abstract tree. - GuEnum* cts = pgf_lzr_concretize(lzr, expr, ppool); + GuEnum* cts = pgf_lzr_concretize(to_concr, expr, ppool); while (true) { PgfCncTree ctree = gu_next(cts, PgfCncTree, ppool); @@ -159,7 +153,7 @@ int main(int argc, char* argv[]) { gu_puts(" ", wtr, err); // Linearize the concrete tree as a simple // sequence of strings. - pgf_lzr_linearize_simple(lzr, ctree, lin_idx, + pgf_lzr_linearize_simple(to_concr , ctree, lin_idx, wtr, err); gu_putc('\n', wtr, err); gu_writer_flush(wtr, err); -- cgit v1.2.3