All pastes #996351 Raw Edit

Miscellany

public text v1 · immutable
#996351 ·published 2008-04-24 21:42 UTC
rendered paste body
$ java -jar jacc.jar json.jacc
WARNING: 2 rules never reduced

WARNING: conflicts: 1 shift/reduce, 6 reduce/reduce

***************************************************
*** json.jacc follows:

%token <String> STRING

%%

object    : '{' members '}' | /* empty */ ;

members   : pair | pair ',' members ;

pair      : string ':' value ;

array     : '[' elements ']' | /* empty */ ;

elements  : value | value ',' elements ;

value     : string | number | object | array | true | false | null ;

true      : 't' 'r' 'u' 'e' ;

false     : 'f' 'a' 'l' 's' 'e' ;

null      : 'n' 'u' 'l' 'l' ;

string    : '"' '"' | '"' chars '"' ;

chars     : char | char chars ;

char      : STRING
          | '\"'
          | '\\'
          | '\\' '/'
          | '\b'
          | '\f'
          | '\n'
          | '\r'
          | '\t'
          | '\\' 'u' hexdigit hexdigit hexdigit hexdigit
          ;

hexdigit  : digit | hexalpha ;

digit     : '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' ;

digit1to9 : '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' ;

digits    : digit | digit digits ;

hexalpha  : 'a' | 'A' | 'b' | 'B' | 'c' | 'C' | 'd' | 'D' | 'e' | 'E' | 'f' | 'F' ;

number    : int | int frac | int exp | int frac exp ;

int       : digit | digit1to9 digits | '-' digit | '-' digit1to9 digits ;

frac      : '.' digits ;

exp       : e digits ;

e         : 'e' | 'e' '+' | 'e' '-' | 'E' | 'E' '+' | 'E' '-' ;