Skip to contents

Note R-based dparser tree walking works on Windows (with R tools) Mac, or Linux. Linking to arbitrary c grammars works on any platform.

Usage

dparse(
  grammar,
  start_state = 0,
  save_parse_tree = TRUE,
  partial_parses = FALSE,
  compare_stacks = TRUE,
  commit_actions_interval = 100,
  fixup = TRUE,
  fixup_ebnf = FALSE,
  nogreedy = FALSE,
  noheight = FALSE,
  use_file_name = TRUE,
  parse_size = 1024,
  verbose_level = 0,
  children_first = TRUE,
  ...
)

Arguments

grammar

Dparser grammar filename (must be a file with a ".g" extension)

start_state

Start State (default 0)

save_parse_tree

Save Parse Tree (default TRUE)

partial_parses

Partial Parses (default FALSE)

compare_stacks

Compare Stacks (default TRUE)

commit_actions_interval

Commit Interval (default 100)

fixup

Fix-up Internal Productions (default FALSE)

fixup_ebnf

Fixup EBNF Productions (default FALSE)

nogreedy

No Greediness for Disambiguation (default FALSE)

noheight

No Height for Disambiguation (default FALSE)

use_file_name

Use File Name for syntax errors (default TRUE)

parse_size

Parser size (default 1024)

verbose_level

the level of verbosity when creating parser (default 0)

children_first

When TRUE, parse the children before the parent (default TRUE).

...

Parameters sent to mkdparse, with the exception of use_r_header which is forced to be TRUE.

Value

A function that allows parsing of a file based on the grammar supplied. This function would be able to parse arbitrary grammars the way you may want with your own user supplied function.

Garbage collection

There are two user options that control if the dlls for the grammars created by dparser will be deleted upon garbage collection or R exit if they are not associated with any active objects. These are:

dpaser.rm.unnamed.parser.dll:

when TRUE, this remove parsers that are created from strings, or other memory-based items in R.

dpaser.rm.unnamed.parser.dll:

when TRUE, this removes parsers created from grammar files.

See also

Examples

# \donttest{
## This creates the R based parsing function.  It requires
## compilation and runs on most OSes, with the exception of solaris.
## Windows requires Rtools to be installed.
f <- dparse(system.file("tran.g", package = "dparser"),children_first=FALSE)

## Once created, you may then use this function to parse an
## arbitrary syntax file.  For example:
f("
b       = -1
d/dt(X) = a*X + Y*Z;
d/dt(Y) = b*(Y - Z);
d/dt(Z) = -X*Y + c*Y - Z
if (t < 0.02 | t > 99.98){
    print
}
", function(name, value, pos, depth){
    ## This prints the name, value, position and depth passed to the
    ##parsing function.
    cat(sprintf("name:%s;value:%s;pos:%s;depth:%s\n", name, value, pos,
                 depth));
})
#> name:statement_list;value:b       = -1
#> d/dt(X) = a*X + Y*Z;
#> d/dt(Y) = b*(Y - Z);
#> d/dt(Z) = -X*Y + c*Y - Z
#> if (t < 0.02 | t > 99.98){
#>     print
#> }
#> ;pos:-2;depth:0
#> name:statement_list;value:b       = -1
#> d/dt(X) = a*X + Y*Z;
#> d/dt(Y) = b*(Y - Z);
#> d/dt(Z) = -X*Y + c*Y - Z
#> if (t < 0.02 | t > 99.98){
#>     print
#> }
#> ;pos:0;depth:0
#> name:statement_list__3;value:b       = -1
#> d/dt(X) = a*X + Y*Z;
#> d/dt(Y) = b*(Y - Z);
#> d/dt(Z) = -X*Y + c*Y - Z
#> if (t < 0.02 | t > 99.98){
#>     print
#> }
#> ;pos:-2;depth:1
#> name:statement_list__3;value:b       = -1
#> ;pos:0;depth:1
#> name:statement_list__2;value:b       = -1
#> ;pos:-2;depth:2
#> name:statement_list__2;value:b       = -1
#> ;pos:0;depth:2
#> name:statement;value:b       = -1
#> ;pos:-2;depth:3
#> name:statement;value:b       = -1;pos:0;depth:3
#> name:ini;value:b       = -1;pos:-2;depth:4
#> name:ini;value:b;pos:0;depth:4
#> name:identifier_r;value:b;pos:-2;depth:5
#> name:identifier_r;value:b;pos:0;depth:5
#> name:identifier_r_1;value:b;pos:-2;depth:6
#> name:identifier_r_1;value:b;pos:0;depth:6
#> name:[a-zA-Z_][a-zA-Z0-9_.]*;value:b;pos:-1;depth:7
#> name:ini;value:=;pos:1;depth:4
#> name:ini__19;value:=;pos:-2;depth:5
#> name:ini__19;value:=;pos:0;depth:5
#> name:=;value:=;pos:-1;depth:6
#> name:ini;value:-1;pos:2;depth:4
#> name:ini_const;value:-1;pos:-2;depth:5
#> name:ini_const;value:-;pos:0;depth:5
#> name:ini_const__80;value:-;pos:-2;depth:6
#> name:ini_const__80;value:-;pos:0;depth:6
#> name:-;value:-;pos:-1;depth:7
#> name:ini_const;value:1;pos:1;depth:5
#> name:constant;value:1;pos:-2;depth:6
#> name:constant;value:1;pos:0;depth:6
#> name:decimalint;value:1;pos:-2;depth:7
#> name:decimalint;value:1;pos:0;depth:7
#> name:0|([1-9][0-9]*);value:1;pos:-1;depth:8
#> name:statement;value:;pos:1;depth:3
#> name:end_statement;value:;pos:-2;depth:4
#> name:end_statement;value:;pos:0;depth:4
#> name:end_statement__36;value:;pos:-1;depth:5
#> name:statement_list__3;value:d/dt(X) = a*X + Y*Z;;pos:1;depth:1
#> name:statement_list__2;value:d/dt(X) = a*X + Y*Z;;pos:-2;depth:2
#> name:statement_list__2;value:d/dt(X) = a*X + Y*Z;;pos:0;depth:2
#> name:statement;value:d/dt(X) = a*X + Y*Z;;pos:-2;depth:3
#> name:statement;value:d/dt(X) = a*X + Y*Z;pos:0;depth:3
#> name:derivative;value:d/dt(X) = a*X + Y*Z;pos:-2;depth:4
#> name:derivative;value:d/dt;pos:0;depth:4
#> name:d/dt;value:d/dt;pos:-1;depth:5
#> name:derivative;value:(;pos:1;depth:4
#> name:(;value:(;pos:-1;depth:5
#> name:derivative;value:X;pos:2;depth:4
#> name:identifier_r_no_output;value:X;pos:-2;depth:5
#> name:identifier_r_no_output;value:X;pos:0;depth:5
#> name:identifier_r_no_output_1;value:X;pos:-2;depth:6
#> name:identifier_r_no_output_1;value:X;pos:0;depth:6
#> name:[a-zA-Z_][a-zA-Z0-9_.]*;value:X;pos:-1;depth:7
#> name:derivative;value:);pos:3;depth:4
#> name:);value:);pos:-1;depth:5
#> name:derivative;value:=;pos:4;depth:4
#> name:derivative__23;value:=;pos:-2;depth:5
#> name:derivative__23;value:=;pos:0;depth:5
#> name:=;value:=;pos:-1;depth:6
#> name:derivative;value:a*X + Y*Z;pos:5;depth:4
#> name:additive_expression;value:a*X + Y*Z;pos:-2;depth:5
#> name:additive_expression;value:a*X;pos:0;depth:5
#> name:multiplicative_expression;value:a*X;pos:-2;depth:6
#> name:multiplicative_expression;value:a;pos:0;depth:6
#> name:unary_expression;value:a;pos:-2;depth:7
#> name:unary_expression;value:;pos:0;depth:7
#> name:unary_expression__66;value:;pos:-1;depth:8
#> name:unary_expression;value:a;pos:1;depth:7
#> name:unary_expression__67;value:a;pos:-2;depth:8
#> name:unary_expression__67;value:a;pos:0;depth:8
#> name:primary_expression;value:a;pos:-2;depth:9
#> name:primary_expression;value:a;pos:0;depth:9
#> name:identifier_r;value:a;pos:-2;depth:10
#> name:identifier_r;value:a;pos:0;depth:10
#> name:identifier_r_1;value:a;pos:-2;depth:11
#> name:identifier_r_1;value:a;pos:0;depth:11
#> name:[a-zA-Z_][a-zA-Z0-9_.]*;value:a;pos:-1;depth:12
#> name:multiplicative_expression;value:*X;pos:1;depth:6
#> name:multiplicative_expression__63;value:*X;pos:-2;depth:7
#> name:multiplicative_expression__63;value:*X;pos:0;depth:7
#> name:multiplicative_expression__61;value:*X;pos:-2;depth:8
#> name:multiplicative_expression__61;value:*;pos:0;depth:8
#> name:multiplicative_expression__61__62;value:*;pos:-2;depth:9
#> name:multiplicative_expression__61__62;value:*;pos:0;depth:9
#> name:*;value:*;pos:-1;depth:10
#> name:multiplicative_expression__61;value:X;pos:1;depth:8
#> name:unary_expression;value:X;pos:-2;depth:9
#> name:unary_expression;value:;pos:0;depth:9
#> name:unary_expression__66;value:;pos:-1;depth:10
#> name:unary_expression;value:X;pos:1;depth:9
#> name:unary_expression__67;value:X;pos:-2;depth:10
#> name:unary_expression__67;value:X;pos:0;depth:10
#> name:primary_expression;value:X;pos:-2;depth:11
#> name:primary_expression;value:X;pos:0;depth:11
#> name:identifier_r;value:X;pos:-2;depth:12
#> name:identifier_r;value:X;pos:0;depth:12
#> name:identifier_r_1;value:X;pos:-2;depth:13
#> name:identifier_r_1;value:X;pos:0;depth:13
#> name:[a-zA-Z_][a-zA-Z0-9_.]*;value:X;pos:-1;depth:14
#> name:additive_expression;value:+ Y*Z;pos:1;depth:5
#> name:additive_expression__59;value:+ Y*Z;pos:-2;depth:6
#> name:additive_expression__59;value:+ Y*Z;pos:0;depth:6
#> name:additive_expression__57;value:+ Y*Z;pos:-2;depth:7
#> name:additive_expression__57;value:+;pos:0;depth:7
#> name:additive_expression__57__58;value:+;pos:-2;depth:8
#> name:additive_expression__57__58;value:+;pos:0;depth:8
#> name:+;value:+;pos:-1;depth:9
#> name:additive_expression__57;value:Y*Z;pos:1;depth:7
#> name:multiplicative_expression;value:Y*Z;pos:-2;depth:8
#> name:multiplicative_expression;value:Y;pos:0;depth:8
#> name:unary_expression;value:Y;pos:-2;depth:9
#> name:unary_expression;value:;pos:0;depth:9
#> name:unary_expression__66;value:;pos:-1;depth:10
#> name:unary_expression;value:Y;pos:1;depth:9
#> name:unary_expression__67;value:Y;pos:-2;depth:10
#> name:unary_expression__67;value:Y;pos:0;depth:10
#> name:primary_expression;value:Y;pos:-2;depth:11
#> name:primary_expression;value:Y;pos:0;depth:11
#> name:identifier_r;value:Y;pos:-2;depth:12
#> name:identifier_r;value:Y;pos:0;depth:12
#> name:identifier_r_1;value:Y;pos:-2;depth:13
#> name:identifier_r_1;value:Y;pos:0;depth:13
#> name:[a-zA-Z_][a-zA-Z0-9_.]*;value:Y;pos:-1;depth:14
#> name:multiplicative_expression;value:*Z;pos:1;depth:8
#> name:multiplicative_expression__63;value:*Z;pos:-2;depth:9
#> name:multiplicative_expression__63;value:*Z;pos:0;depth:9
#> name:multiplicative_expression__61;value:*Z;pos:-2;depth:10
#> name:multiplicative_expression__61;value:*;pos:0;depth:10
#> name:multiplicative_expression__61__62;value:*;pos:-2;depth:11
#> name:multiplicative_expression__61__62;value:*;pos:0;depth:11
#> name:*;value:*;pos:-1;depth:12
#> name:multiplicative_expression__61;value:Z;pos:1;depth:10
#> name:unary_expression;value:Z;pos:-2;depth:11
#> name:unary_expression;value:;pos:0;depth:11
#> name:unary_expression__66;value:;pos:-1;depth:12
#> name:unary_expression;value:Z;pos:1;depth:11
#> name:unary_expression__67;value:Z;pos:-2;depth:12
#> name:unary_expression__67;value:Z;pos:0;depth:12
#> name:primary_expression;value:Z;pos:-2;depth:13
#> name:primary_expression;value:Z;pos:0;depth:13
#> name:identifier_r;value:Z;pos:-2;depth:14
#> name:identifier_r;value:Z;pos:0;depth:14
#> name:identifier_r_1;value:Z;pos:-2;depth:15
#> name:identifier_r_1;value:Z;pos:0;depth:15
#> name:[a-zA-Z_][a-zA-Z0-9_.]*;value:Z;pos:-1;depth:16
#> name:statement;value:;;pos:1;depth:3
#> name:end_statement;value:;;pos:-2;depth:4
#> name:end_statement;value:;;pos:0;depth:4
#> name:end_statement__36;value:;;pos:-2;depth:5
#> name:end_statement__36;value:;;pos:0;depth:5
#> name:end_statement__35;value:;;pos:-2;depth:6
#> name:end_statement__35;value:;;pos:0;depth:6
#> name:;;value:;;pos:-1;depth:7
#> name:statement_list__3;value:d/dt(Y) = b*(Y - Z);;pos:2;depth:1
#> name:statement_list__2;value:d/dt(Y) = b*(Y - Z);;pos:-2;depth:2
#> name:statement_list__2;value:d/dt(Y) = b*(Y - Z);;pos:0;depth:2
#> name:statement;value:d/dt(Y) = b*(Y - Z);;pos:-2;depth:3
#> name:statement;value:d/dt(Y) = b*(Y - Z);pos:0;depth:3
#> name:derivative;value:d/dt(Y) = b*(Y - Z);pos:-2;depth:4
#> name:derivative;value:d/dt;pos:0;depth:4
#> name:d/dt;value:d/dt;pos:-1;depth:5
#> name:derivative;value:(;pos:1;depth:4
#> name:(;value:(;pos:-1;depth:5
#> name:derivative;value:Y;pos:2;depth:4
#> name:identifier_r_no_output;value:Y;pos:-2;depth:5
#> name:identifier_r_no_output;value:Y;pos:0;depth:5
#> name:identifier_r_no_output_1;value:Y;pos:-2;depth:6
#> name:identifier_r_no_output_1;value:Y;pos:0;depth:6
#> name:[a-zA-Z_][a-zA-Z0-9_.]*;value:Y;pos:-1;depth:7
#> name:derivative;value:);pos:3;depth:4
#> name:);value:);pos:-1;depth:5
#> name:derivative;value:=;pos:4;depth:4
#> name:derivative__23;value:=;pos:-2;depth:5
#> name:derivative__23;value:=;pos:0;depth:5
#> name:=;value:=;pos:-1;depth:6
#> name:derivative;value:b*(Y - Z);pos:5;depth:4
#> name:additive_expression;value:b*(Y - Z);pos:-2;depth:5
#> name:additive_expression;value:b*(Y - Z);pos:0;depth:5
#> name:multiplicative_expression;value:b*(Y - Z);pos:-2;depth:6
#> name:multiplicative_expression;value:b;pos:0;depth:6
#> name:unary_expression;value:b;pos:-2;depth:7
#> name:unary_expression;value:;pos:0;depth:7
#> name:unary_expression__66;value:;pos:-1;depth:8
#> name:unary_expression;value:b;pos:1;depth:7
#> name:unary_expression__67;value:b;pos:-2;depth:8
#> name:unary_expression__67;value:b;pos:0;depth:8
#> name:primary_expression;value:b;pos:-2;depth:9
#> name:primary_expression;value:b;pos:0;depth:9
#> name:identifier_r;value:b;pos:-2;depth:10
#> name:identifier_r;value:b;pos:0;depth:10
#> name:identifier_r_1;value:b;pos:-2;depth:11
#> name:identifier_r_1;value:b;pos:0;depth:11
#> name:[a-zA-Z_][a-zA-Z0-9_.]*;value:b;pos:-1;depth:12
#> name:multiplicative_expression;value:*(Y - Z);pos:1;depth:6
#> name:multiplicative_expression__63;value:*(Y - Z);pos:-2;depth:7
#> name:multiplicative_expression__63;value:*(Y - Z);pos:0;depth:7
#> name:multiplicative_expression__61;value:*(Y - Z);pos:-2;depth:8
#> name:multiplicative_expression__61;value:*;pos:0;depth:8
#> name:multiplicative_expression__61__62;value:*;pos:-2;depth:9
#> name:multiplicative_expression__61__62;value:*;pos:0;depth:9
#> name:*;value:*;pos:-1;depth:10
#> name:multiplicative_expression__61;value:(Y - Z);pos:1;depth:8
#> name:unary_expression;value:(Y - Z);pos:-2;depth:9
#> name:unary_expression;value:;pos:0;depth:9
#> name:unary_expression__66;value:;pos:-1;depth:10
#> name:unary_expression;value:(Y - Z);pos:1;depth:9
#> name:unary_expression__67;value:(Y - Z);pos:-2;depth:10
#> name:unary_expression__67;value:(Y - Z);pos:0;depth:10
#> name:primary_expression;value:(Y - Z);pos:-2;depth:11
#> name:primary_expression;value:(;pos:0;depth:11
#> name:(;value:(;pos:-1;depth:12
#> name:primary_expression;value:Y - Z;pos:1;depth:11
#> name:additive_expression;value:Y - Z;pos:-2;depth:12
#> name:additive_expression;value:Y ;pos:0;depth:12
#> name:multiplicative_expression;value:Y ;pos:-2;depth:13
#> name:multiplicative_expression;value:Y;pos:0;depth:13
#> name:unary_expression;value:Y;pos:-2;depth:14
#> name:unary_expression;value:;pos:0;depth:14
#> name:unary_expression__66;value:;pos:-1;depth:15
#> name:unary_expression;value:Y;pos:1;depth:14
#> name:unary_expression__67;value:Y;pos:-2;depth:15
#> name:unary_expression__67;value:Y;pos:0;depth:15
#> name:primary_expression;value:Y;pos:-2;depth:16
#> name:primary_expression;value:Y;pos:0;depth:16
#> name:identifier_r;value:Y;pos:-2;depth:17
#> name:identifier_r;value:Y;pos:0;depth:17
#> name:identifier_r_1;value:Y;pos:-2;depth:18
#> name:identifier_r_1;value:Y;pos:0;depth:18
#> name:[a-zA-Z_][a-zA-Z0-9_.]*;value:Y;pos:-1;depth:19
#> name:multiplicative_expression;value:;pos:1;depth:13
#> name:multiplicative_expression__63;value:;pos:-1;depth:14
#> name:additive_expression;value:- Z;pos:1;depth:12
#> name:additive_expression__59;value:- Z;pos:-2;depth:13
#> name:additive_expression__59;value:- Z;pos:0;depth:13
#> name:additive_expression__57;value:- Z;pos:-2;depth:14
#> name:additive_expression__57;value:-;pos:0;depth:14
#> name:additive_expression__57__58;value:-;pos:-2;depth:15
#> name:additive_expression__57__58;value:-;pos:0;depth:15
#> name:-;value:-;pos:-1;depth:16
#> name:additive_expression__57;value:Z;pos:1;depth:14
#> name:multiplicative_expression;value:Z;pos:-2;depth:15
#> name:multiplicative_expression;value:Z;pos:0;depth:15
#> name:unary_expression;value:Z;pos:-2;depth:16
#> name:unary_expression;value:;pos:0;depth:16
#> name:unary_expression__66;value:;pos:-1;depth:17
#> name:unary_expression;value:Z;pos:1;depth:16
#> name:unary_expression__67;value:Z;pos:-2;depth:17
#> name:unary_expression__67;value:Z;pos:0;depth:17
#> name:primary_expression;value:Z;pos:-2;depth:18
#> name:primary_expression;value:Z;pos:0;depth:18
#> name:identifier_r;value:Z;pos:-2;depth:19
#> name:identifier_r;value:Z;pos:0;depth:19
#> name:identifier_r_1;value:Z;pos:-2;depth:20
#> name:identifier_r_1;value:Z;pos:0;depth:20
#> name:[a-zA-Z_][a-zA-Z0-9_.]*;value:Z;pos:-1;depth:21
#> name:multiplicative_expression;value:;pos:1;depth:15
#> name:multiplicative_expression__63;value:;pos:-1;depth:16
#> name:primary_expression;value:);pos:2;depth:11
#> name:);value:);pos:-1;depth:12
#> name:additive_expression;value:;pos:1;depth:5
#> name:additive_expression__59;value:;pos:-1;depth:6
#> name:statement;value:;;pos:1;depth:3
#> name:end_statement;value:;;pos:-2;depth:4
#> name:end_statement;value:;;pos:0;depth:4
#> name:end_statement__36;value:;;pos:-2;depth:5
#> name:end_statement__36;value:;;pos:0;depth:5
#> name:end_statement__35;value:;;pos:-2;depth:6
#> name:end_statement__35;value:;;pos:0;depth:6
#> name:;;value:;;pos:-1;depth:7
#> name:statement_list__3;value:d/dt(Z) = -X*Y + c*Y - Z
#> ;pos:3;depth:1
#> name:statement_list__2;value:d/dt(Z) = -X*Y + c*Y - Z
#> ;pos:-2;depth:2
#> name:statement_list__2;value:d/dt(Z) = -X*Y + c*Y - Z
#> ;pos:0;depth:2
#> name:statement;value:d/dt(Z) = -X*Y + c*Y - Z
#> ;pos:-2;depth:3
#> name:statement;value:d/dt(Z) = -X*Y + c*Y - Z
#> ;pos:0;depth:3
#> name:derivative;value:d/dt(Z) = -X*Y + c*Y - Z
#> ;pos:-2;depth:4
#> name:derivative;value:d/dt;pos:0;depth:4
#> name:d/dt;value:d/dt;pos:-1;depth:5
#> name:derivative;value:(;pos:1;depth:4
#> name:(;value:(;pos:-1;depth:5
#> name:derivative;value:Z;pos:2;depth:4
#> name:identifier_r_no_output;value:Z;pos:-2;depth:5
#> name:identifier_r_no_output;value:Z;pos:0;depth:5
#> name:identifier_r_no_output_1;value:Z;pos:-2;depth:6
#> name:identifier_r_no_output_1;value:Z;pos:0;depth:6
#> name:[a-zA-Z_][a-zA-Z0-9_.]*;value:Z;pos:-1;depth:7
#> name:derivative;value:);pos:3;depth:4
#> name:);value:);pos:-1;depth:5
#> name:derivative;value:=;pos:4;depth:4
#> name:derivative__23;value:=;pos:-2;depth:5
#> name:derivative__23;value:=;pos:0;depth:5
#> name:=;value:=;pos:-1;depth:6
#> name:derivative;value:-X*Y + c*Y - Z
#> ;pos:5;depth:4
#> name:additive_expression;value:-X*Y + c*Y - Z
#> ;pos:-2;depth:5
#> name:additive_expression;value:-X*Y;pos:0;depth:5
#> name:multiplicative_expression;value:-X*Y;pos:-2;depth:6
#> name:multiplicative_expression;value:-X;pos:0;depth:6
#> name:unary_expression;value:-X;pos:-2;depth:7
#> name:unary_expression;value:-;pos:0;depth:7
#> name:unary_expression__66;value:-;pos:-2;depth:8
#> name:unary_expression__66;value:-;pos:0;depth:8
#> name:unary_expression__65;value:-;pos:-2;depth:9
#> name:unary_expression__65;value:-;pos:0;depth:9
#> name:-;value:-;pos:-1;depth:10
#> name:unary_expression;value:X;pos:1;depth:7
#> name:unary_expression__67;value:X;pos:-2;depth:8
#> name:unary_expression__67;value:X;pos:0;depth:8
#> name:primary_expression;value:X;pos:-2;depth:9
#> name:primary_expression;value:X;pos:0;depth:9
#> name:identifier_r;value:X;pos:-2;depth:10
#> name:identifier_r;value:X;pos:0;depth:10
#> name:identifier_r_1;value:X;pos:-2;depth:11
#> name:identifier_r_1;value:X;pos:0;depth:11
#> name:[a-zA-Z_][a-zA-Z0-9_.]*;value:X;pos:-1;depth:12
#> name:multiplicative_expression;value:*Y;pos:1;depth:6
#> name:multiplicative_expression__63;value:*Y;pos:-2;depth:7
#> name:multiplicative_expression__63;value:*Y;pos:0;depth:7
#> name:multiplicative_expression__61;value:*Y;pos:-2;depth:8
#> name:multiplicative_expression__61;value:*;pos:0;depth:8
#> name:multiplicative_expression__61__62;value:*;pos:-2;depth:9
#> name:multiplicative_expression__61__62;value:*;pos:0;depth:9
#> name:*;value:*;pos:-1;depth:10
#> name:multiplicative_expression__61;value:Y;pos:1;depth:8
#> name:unary_expression;value:Y;pos:-2;depth:9
#> name:unary_expression;value:;pos:0;depth:9
#> name:unary_expression__66;value:;pos:-1;depth:10
#> name:unary_expression;value:Y;pos:1;depth:9
#> name:unary_expression__67;value:Y;pos:-2;depth:10
#> name:unary_expression__67;value:Y;pos:0;depth:10
#> name:primary_expression;value:Y;pos:-2;depth:11
#> name:primary_expression;value:Y;pos:0;depth:11
#> name:identifier_r;value:Y;pos:-2;depth:12
#> name:identifier_r;value:Y;pos:0;depth:12
#> name:identifier_r_1;value:Y;pos:-2;depth:13
#> name:identifier_r_1;value:Y;pos:0;depth:13
#> name:[a-zA-Z_][a-zA-Z0-9_.]*;value:Y;pos:-1;depth:14
#> name:additive_expression;value:+ c*Y - Z
#> ;pos:1;depth:5
#> name:additive_expression__59;value:+ c*Y - Z
#> ;pos:-2;depth:6
#> name:additive_expression__59;value:+ c*Y;pos:0;depth:6
#> name:additive_expression__57;value:+ c*Y;pos:-2;depth:7
#> name:additive_expression__57;value:+;pos:0;depth:7
#> name:additive_expression__57__58;value:+;pos:-2;depth:8
#> name:additive_expression__57__58;value:+;pos:0;depth:8
#> name:+;value:+;pos:-1;depth:9
#> name:additive_expression__57;value:c*Y;pos:1;depth:7
#> name:multiplicative_expression;value:c*Y;pos:-2;depth:8
#> name:multiplicative_expression;value:c;pos:0;depth:8
#> name:unary_expression;value:c;pos:-2;depth:9
#> name:unary_expression;value:;pos:0;depth:9
#> name:unary_expression__66;value:;pos:-1;depth:10
#> name:unary_expression;value:c;pos:1;depth:9
#> name:unary_expression__67;value:c;pos:-2;depth:10
#> name:unary_expression__67;value:c;pos:0;depth:10
#> name:primary_expression;value:c;pos:-2;depth:11
#> name:primary_expression;value:c;pos:0;depth:11
#> name:identifier_r;value:c;pos:-2;depth:12
#> name:identifier_r;value:c;pos:0;depth:12
#> name:identifier_r_1;value:c;pos:-2;depth:13
#> name:identifier_r_1;value:c;pos:0;depth:13
#> name:[a-zA-Z_][a-zA-Z0-9_.]*;value:c;pos:-1;depth:14
#> name:multiplicative_expression;value:*Y;pos:1;depth:8
#> name:multiplicative_expression__63;value:*Y;pos:-2;depth:9
#> name:multiplicative_expression__63;value:*Y;pos:0;depth:9
#> name:multiplicative_expression__61;value:*Y;pos:-2;depth:10
#> name:multiplicative_expression__61;value:*;pos:0;depth:10
#> name:multiplicative_expression__61__62;value:*;pos:-2;depth:11
#> name:multiplicative_expression__61__62;value:*;pos:0;depth:11
#> name:*;value:*;pos:-1;depth:12
#> name:multiplicative_expression__61;value:Y;pos:1;depth:10
#> name:unary_expression;value:Y;pos:-2;depth:11
#> name:unary_expression;value:;pos:0;depth:11
#> name:unary_expression__66;value:;pos:-1;depth:12
#> name:unary_expression;value:Y;pos:1;depth:11
#> name:unary_expression__67;value:Y;pos:-2;depth:12
#> name:unary_expression__67;value:Y;pos:0;depth:12
#> name:primary_expression;value:Y;pos:-2;depth:13
#> name:primary_expression;value:Y;pos:0;depth:13
#> name:identifier_r;value:Y;pos:-2;depth:14
#> name:identifier_r;value:Y;pos:0;depth:14
#> name:identifier_r_1;value:Y;pos:-2;depth:15
#> name:identifier_r_1;value:Y;pos:0;depth:15
#> name:[a-zA-Z_][a-zA-Z0-9_.]*;value:Y;pos:-1;depth:16
#> name:additive_expression__59;value:- Z
#> ;pos:1;depth:6
#> name:additive_expression__57;value:- Z
#> ;pos:-2;depth:7
#> name:additive_expression__57;value:-;pos:0;depth:7
#> name:additive_expression__57__58;value:-;pos:-2;depth:8
#> name:additive_expression__57__58;value:-;pos:0;depth:8
#> name:-;value:-;pos:-1;depth:9
#> name:additive_expression__57;value:Z
#> ;pos:1;depth:7
#> name:multiplicative_expression;value:Z
#> ;pos:-2;depth:8
#> name:multiplicative_expression;value:Z;pos:0;depth:8
#> name:unary_expression;value:Z;pos:-2;depth:9
#> name:unary_expression;value:;pos:0;depth:9
#> name:unary_expression__66;value:;pos:-1;depth:10
#> name:unary_expression;value:Z;pos:1;depth:9
#> name:unary_expression__67;value:Z;pos:-2;depth:10
#> name:unary_expression__67;value:Z;pos:0;depth:10
#> name:primary_expression;value:Z;pos:-2;depth:11
#> name:primary_expression;value:Z;pos:0;depth:11
#> name:identifier_r;value:Z;pos:-2;depth:12
#> name:identifier_r;value:Z;pos:0;depth:12
#> name:identifier_r_1;value:Z;pos:-2;depth:13
#> name:identifier_r_1;value:Z;pos:0;depth:13
#> name:[a-zA-Z_][a-zA-Z0-9_.]*;value:Z;pos:-1;depth:14
#> name:multiplicative_expression;value:;pos:1;depth:8
#> name:multiplicative_expression__63;value:;pos:-1;depth:9
#> name:statement;value:;pos:1;depth:3
#> name:end_statement;value:;pos:-2;depth:4
#> name:end_statement;value:;pos:0;depth:4
#> name:end_statement__36;value:;pos:-1;depth:5
#> name:statement_list__3;value:if (t < 0.02 | t > 99.98){
#>     print
#> }
#> ;pos:4;depth:1
#> name:statement_list__2;value:if (t < 0.02 | t > 99.98){
#>     print
#> }
#> ;pos:-2;depth:2
#> name:statement_list__2;value:if (t < 0.02 | t > 99.98){
#>     print
#> }
#> ;pos:0;depth:2
#> name:statement;value:if (t < 0.02 | t > 99.98){
#>     print
#> }
#> ;pos:-2;depth:3
#> name:statement;value:if (t < 0.02 | t > 99.98){
#>     print
#> }
#> ;pos:0;depth:3
#> name:selection_statement;value:if (t < 0.02 | t > 99.98){
#>     print
#> }
#> ;pos:-2;depth:4
#> name:selection_statement;value:if;pos:0;depth:4
#> name:if;value:if;pos:-1;depth:5
#> name:selection_statement;value:(;pos:1;depth:4
#> name:(;value:(;pos:-1;depth:5
#> name:selection_statement;value:t < 0.02 | t > 99.98;pos:2;depth:4
#> name:logical_or_expression;value:t < 0.02 | t > 99.98;pos:-2;depth:5
#> name:logical_or_expression;value:t < 0.02 ;pos:0;depth:5
#> name:logical_and_expression;value:t < 0.02 ;pos:-2;depth:6
#> name:logical_and_expression;value:t < 0.02 ;pos:0;depth:6
#> name:equality_expression0;value:t < 0.02 ;pos:-2;depth:7
#> name:equality_expression0;value:t < 0.02 ;pos:0;depth:7
#> name:equality_expression;value:t < 0.02 ;pos:-2;depth:8
#> name:equality_expression;value:t < 0.02 ;pos:0;depth:8
#> name:relational_expression;value:t < 0.02 ;pos:-2;depth:9
#> name:relational_expression;value:t ;pos:0;depth:9
#> name:additive_expression;value:t ;pos:-2;depth:10
#> name:additive_expression;value:t ;pos:0;depth:10
#> name:multiplicative_expression;value:t ;pos:-2;depth:11
#> name:multiplicative_expression;value:t;pos:0;depth:11
#> name:unary_expression;value:t;pos:-2;depth:12
#> name:unary_expression;value:;pos:0;depth:12
#> name:unary_expression__66;value:;pos:-1;depth:13
#> name:unary_expression;value:t;pos:1;depth:12
#> name:unary_expression__67;value:t;pos:-2;depth:13
#> name:unary_expression__67;value:t;pos:0;depth:13
#> name:primary_expression;value:t;pos:-2;depth:14
#> name:primary_expression;value:t;pos:0;depth:14
#> name:identifier_r;value:t;pos:-2;depth:15
#> name:identifier_r;value:t;pos:0;depth:15
#> name:identifier_r_1;value:t;pos:-2;depth:16
#> name:identifier_r_1;value:t;pos:0;depth:16
#> name:[a-zA-Z_][a-zA-Z0-9_.]*;value:t;pos:-1;depth:17
#> name:multiplicative_expression;value:;pos:1;depth:11
#> name:multiplicative_expression__63;value:;pos:-1;depth:12
#> name:additive_expression;value:;pos:1;depth:10
#> name:additive_expression__59;value:;pos:-1;depth:11
#> name:relational_expression;value:< 0.02 ;pos:1;depth:9
#> name:relational_expression__55;value:< 0.02 ;pos:-2;depth:10
#> name:relational_expression__55;value:< 0.02 ;pos:0;depth:10
#> name:relational_expression__53;value:< 0.02 ;pos:-2;depth:11
#> name:relational_expression__53;value:<;pos:0;depth:11
#> name:relational_expression__53__54;value:<;pos:-2;depth:12
#> name:relational_expression__53__54;value:<;pos:0;depth:12
#> name:<;value:<;pos:-1;depth:13
#> name:relational_expression__53;value:0.02 ;pos:1;depth:11
#> name:additive_expression;value:0.02 ;pos:-2;depth:12
#> name:additive_expression;value:0.02 ;pos:0;depth:12
#> name:multiplicative_expression;value:0.02 ;pos:-2;depth:13
#> name:multiplicative_expression;value:0.02;pos:0;depth:13
#> name:unary_expression;value:0.02;pos:-2;depth:14
#> name:unary_expression;value:;pos:0;depth:14
#> name:unary_expression__66;value:;pos:-1;depth:15
#> name:unary_expression;value:0.02;pos:1;depth:14
#> name:unary_expression__67;value:0.02;pos:-2;depth:15
#> name:unary_expression__67;value:0.02;pos:0;depth:15
#> name:primary_expression;value:0.02;pos:-2;depth:16
#> name:primary_expression;value:0.02;pos:0;depth:16
#> name:constant;value:0.02;pos:-2;depth:17
#> name:constant;value:0.02;pos:0;depth:17
#> name:float1;value:0.02;pos:-2;depth:18
#> name:float1;value:0.02;pos:0;depth:18
#> name:([0-9]+.[0-9]*|[0-9]*.[0-9]+)([eE][\-\+]?[0-9]+)?;value:0.02;pos:-1;depth:19
#> name:multiplicative_expression;value:;pos:1;depth:13
#> name:multiplicative_expression__63;value:;pos:-1;depth:14
#> name:additive_expression;value:;pos:1;depth:12
#> name:additive_expression__59;value:;pos:-1;depth:13
#> name:equality_expression;value:;pos:1;depth:8
#> name:equality_expression__51;value:;pos:-1;depth:9
#> name:logical_and_expression;value:;pos:1;depth:6
#> name:logical_and_expression__46;value:;pos:-1;depth:7
#> name:logical_or_expression;value:| t > 99.98;pos:1;depth:5
#> name:logical_or_expression__42;value:| t > 99.98;pos:-2;depth:6
#> name:logical_or_expression__42;value:| t > 99.98;pos:0;depth:6
#> name:logical_or_expression__40;value:| t > 99.98;pos:-2;depth:7
#> name:logical_or_expression__40;value:|;pos:0;depth:7
#> name:logical_or_expression__40__41;value:|;pos:-2;depth:8
#> name:logical_or_expression__40__41;value:|;pos:0;depth:8
#> name:|;value:|;pos:-1;depth:9
#> name:logical_or_expression__40;value:t > 99.98;pos:1;depth:7
#> name:logical_and_expression;value:t > 99.98;pos:-2;depth:8
#> name:logical_and_expression;value:t > 99.98;pos:0;depth:8
#> name:equality_expression0;value:t > 99.98;pos:-2;depth:9
#> name:equality_expression0;value:t > 99.98;pos:0;depth:9
#> name:equality_expression;value:t > 99.98;pos:-2;depth:10
#> name:equality_expression;value:t > 99.98;pos:0;depth:10
#> name:relational_expression;value:t > 99.98;pos:-2;depth:11
#> name:relational_expression;value:t ;pos:0;depth:11
#> name:additive_expression;value:t ;pos:-2;depth:12
#> name:additive_expression;value:t ;pos:0;depth:12
#> name:multiplicative_expression;value:t ;pos:-2;depth:13
#> name:multiplicative_expression;value:t;pos:0;depth:13
#> name:unary_expression;value:t;pos:-2;depth:14
#> name:unary_expression;value:;pos:0;depth:14
#> name:unary_expression__66;value:;pos:-1;depth:15
#> name:unary_expression;value:t;pos:1;depth:14
#> name:unary_expression__67;value:t;pos:-2;depth:15
#> name:unary_expression__67;value:t;pos:0;depth:15
#> name:primary_expression;value:t;pos:-2;depth:16
#> name:primary_expression;value:t;pos:0;depth:16
#> name:identifier_r;value:t;pos:-2;depth:17
#> name:identifier_r;value:t;pos:0;depth:17
#> name:identifier_r_1;value:t;pos:-2;depth:18
#> name:identifier_r_1;value:t;pos:0;depth:18
#> name:[a-zA-Z_][a-zA-Z0-9_.]*;value:t;pos:-1;depth:19
#> name:multiplicative_expression;value:;pos:1;depth:13
#> name:multiplicative_expression__63;value:;pos:-1;depth:14
#> name:additive_expression;value:;pos:1;depth:12
#> name:additive_expression__59;value:;pos:-1;depth:13
#> name:relational_expression;value:> 99.98;pos:1;depth:11
#> name:relational_expression__55;value:> 99.98;pos:-2;depth:12
#> name:relational_expression__55;value:> 99.98;pos:0;depth:12
#> name:relational_expression__53;value:> 99.98;pos:-2;depth:13
#> name:relational_expression__53;value:>;pos:0;depth:13
#> name:relational_expression__53__54;value:>;pos:-2;depth:14
#> name:relational_expression__53__54;value:>;pos:0;depth:14
#> name:>;value:>;pos:-1;depth:15
#> name:relational_expression__53;value:99.98;pos:1;depth:13
#> name:additive_expression;value:99.98;pos:-2;depth:14
#> name:additive_expression;value:99.98;pos:0;depth:14
#> name:multiplicative_expression;value:99.98;pos:-2;depth:15
#> name:multiplicative_expression;value:99.98;pos:0;depth:15
#> name:unary_expression;value:99.98;pos:-2;depth:16
#> name:unary_expression;value:;pos:0;depth:16
#> name:unary_expression__66;value:;pos:-1;depth:17
#> name:unary_expression;value:99.98;pos:1;depth:16
#> name:unary_expression__67;value:99.98;pos:-2;depth:17
#> name:unary_expression__67;value:99.98;pos:0;depth:17
#> name:primary_expression;value:99.98;pos:-2;depth:18
#> name:primary_expression;value:99.98;pos:0;depth:18
#> name:constant;value:99.98;pos:-2;depth:19
#> name:constant;value:99.98;pos:0;depth:19
#> name:float1;value:99.98;pos:-2;depth:20
#> name:float1;value:99.98;pos:0;depth:20
#> name:([0-9]+.[0-9]*|[0-9]*.[0-9]+)([eE][\-\+]?[0-9]+)?;value:99.98;pos:-1;depth:21
#> name:multiplicative_expression;value:;pos:1;depth:15
#> name:multiplicative_expression__63;value:;pos:-1;depth:16
#> name:additive_expression;value:;pos:1;depth:14
#> name:additive_expression__59;value:;pos:-1;depth:15
#> name:equality_expression;value:;pos:1;depth:10
#> name:equality_expression__51;value:;pos:-1;depth:11
#> name:logical_and_expression;value:;pos:1;depth:8
#> name:logical_and_expression__46;value:;pos:-1;depth:9
#> name:selection_statement;value:);pos:3;depth:4
#> name:);value:);pos:-1;depth:5
#> name:selection_statement;value:{
#>     print
#> };pos:4;depth:4
#> name:statement;value:{
#>     print
#> };pos:-2;depth:5
#> name:statement;value:{
#>     print
#> };pos:0;depth:5
#> name:compound_statement;value:{
#>     print
#> };pos:-2;depth:6
#> name:compound_statement;value:{;pos:0;depth:6
#> name:{;value:{;pos:-1;depth:7
#> name:compound_statement;value:print
#> ;pos:1;depth:6
#> name:compound_statement__6;value:print
#> ;pos:-2;depth:7
#> name:compound_statement__6;value:print
#> ;pos:0;depth:7
#> name:statement_list;value:print
#> ;pos:-2;depth:8
#> name:statement_list;value:print
#> ;pos:0;depth:8
#> name:statement_list__3;value:print
#> ;pos:-2;depth:9
#> name:statement_list__3;value:print
#> ;pos:0;depth:9
#> name:statement_list__2;value:print
#> ;pos:-2;depth:10
#> name:statement_list__2;value:print
#> ;pos:0;depth:10
#> name:statement;value:print
#> ;pos:-2;depth:11
#> name:statement;value:print;pos:0;depth:11
#> name:print_command;value:print;pos:-2;depth:12
#> name:print_command;value:print;pos:0;depth:12
#> name:print;value:print;pos:-1;depth:13
#> name:statement;value:;pos:1;depth:11
#> name:end_statement;value:;pos:-2;depth:12
#> name:end_statement;value:;pos:0;depth:12
#> name:end_statement__36;value:;pos:-1;depth:13
#> name:compound_statement;value:};pos:2;depth:6
#> name:};value:};pos:-1;depth:7
#> name:selection_statement;value:;pos:5;depth:4
#> name:selection_statement__9;value:;pos:-1;depth:5

## You could use a better R parsing function; You could also use
## this as a starting place for your own C-based parser
# }