caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] RE: parsing Java with ocamllex/yacc
@ 2001-07-21 21:05 Serguei Ouklonski
  0 siblings, 0 replies; only message in thread
From: Serguei Ouklonski @ 2001-07-21 21:05 UTC (permalink / raw)
  To: caml-list; +Cc: david.chemouil

[-- Attachment #1: Type: text/plain, Size: 239 bytes --]

Hi

Here is Java 1.1 grammar for OCaml based on

"Free Yacc-able Java(tm) grammar" (see
http://home.inreach.com/bronikov/grammars)

Grammar seems to be OK, except for "**/" end of comments (e.g. /** ....
**/ )


Hope it will help

Serguei

[-- Attachment #2: java11_y.mly --]
[-- Type: application/octet-stream, Size: 14730 bytes --]

%{
open List

type primitive_type_t = Boolean | Char | Byte | Short | Int | Long | Float | Double | Void | Qualified of string list

%}

%token OP_AND OP_OR OP_MOD OP_NOT OP_LNOT OP_GT OP_LT
%token OP_ASSIGN SEMICOLON COLON RPAREN LPAREN RBRACK
%token LBRACK MINUS OP_DIV ASTERISK PLUS RCBRACK LCBRACK
%token OP_XOR OP_AIF COMMA PERIOD
%token ABSTRACT
%token BOOLEAN BREAK BYTE BYVALUE
%token CASE CATCH CHAR CLASS CONST CONTINUE
%token DEFAULT DO DOUBLE
%token ELSE EXTENDS
%token FINAL FINALLY FLOAT FOR
%token GOTO
%token IF IMPLEMENTS IMPORT INSTANCEOF INT INTERFACE
%token LONG
%token NATIVE NEW JNULL
%token PACKAGE PRIVATE PROTECTED PUBLIC
%token RETURN
%token SHORT STATIC SUPER SWITCH SYNCHRONIZED
%token THIS THROW THROWS TRANSIENT TRY
%token VOID VOLATILE
%token WHILE
%token OP_INC OP_DEC
%token OP_SHL OP_SHR OP_SHRR
%token OP_GE OP_LE OP_EQ OP_NE
%token OP_LAND OP_LOR
%token OP_DIM
%token ASS_MUL ASS_DIV ASS_MOD ASS_ADD ASS_SUB
%token ASS_SHL ASS_SHR ASS_SHRR ASS_AND ASS_XOR ASS_OR
%token <string> IDENTIFIER 
%token <string> LITERAL

%right OP_ASSIGN ASS_ADD ASS_SUB ASS_MUL ASS_DIV ASS_AND ASS_OR ASS_XOR ASS_MOD ASS_SHL ASS_SHR ASS_SHRR
%left  BOOLEAN_IF
%left  OP_LOR
%left  OP_LAND
%left  OP_OR
%left  OP_AND
%left  OP_EQ OP_NE
%left  INSTANCEOF OP_LE OP_GE OP_LT OP_GT
%left  OP_SHR OP_SHL OP_SHRR
%left  PLUS MINUS
%left  ASTERISK OP_DIV OP_MOD
%right INC_DEC LOGICAL_UNARY ARITHM_UNARY TYPE_CONV
%left  PERIOD LBRACK LPAREN
%right OBJECT_ALLOC

%token CAST FUTURE GENERIC INNER OPERATOR OUTER REST VAR

%start compilation_unit
%type <int> compilation_unit

%%

type_specifier
	: type_name {1}
	| type_name dims {1}
	;

type_name
	: primitive_type {$1}
	| qualified_name {Qualified($1)}
	;

class_name_list
    : qualified_name { [ $1 ] }
    | class_name_list COMMA qualified_name {List.append $1 [ $3 ] }
	;

primitive_type
	: BOOLEAN { Boolean }
	| CHAR { Char }
	| BYTE { Byte }
	| SHORT { Short }
	| INT { Int }
	| LONG { Long }
	| FLOAT { Float }
	| DOUBLE { Double }
	| VOID { Void }
	;

semi_colons
	: SEMICOLON {1}
    | semi_colons SEMICOLON {1}
    ;

compilation_unit
	: program_file { $1 }
    ;

program_file
	: package_statement import_statements type_declarations {1}
	| package_statement import_statements                   {1}
	| package_statement                   type_declarations {1}
	|                   import_statements type_declarations {1}
	| package_statement									    {1}
	|                   import_statements				    {1}
	|                                     type_declarations {$1}
	;

package_statement
	: PACKAGE qualified_name semi_colons {$2}
	;

type_declarations
	: type_declaration_opt_semi {$1}
	| type_declarations type_declaration_opt_semi {1}
	;

type_declaration_opt_semi
    : type_declaration {$1}
    | type_declaration semi_colons {1}
    ;

import_statements
	: import_statement { [ $1 ] }
	| import_statements import_statement { List.append $1 [ $2 ] }
	;

import_statement
	: IMPORT qualified_name semi_colons {$2}
	| IMPORT qualified_name PERIOD ASTERISK semi_colons {List.append $2 ["*"] }
	;

qualified_name
	: IDENTIFIER { [ $1 ] }
	| qualified_name PERIOD IDENTIFIER { List.append $1 [ $3 ] }
	;

type_declaration
	: class_header LCBRACK field_declarations RCBRACK {1}
	| class_header LCBRACK RCBRACK {$1}
	;

class_header
	: modifiers class_word IDENTIFIER extends interfaces {1}
	| modifiers class_word IDENTIFIER extends            {1}
	| modifiers class_word IDENTIFIER         interfaces {1}
	|           class_word IDENTIFIER extends interfaces {1}
	| modifiers class_word IDENTIFIER					 {1}
	|           class_word IDENTIFIER extends			 {1}
	|           class_word IDENTIFIER         interfaces {1}
	|           class_word IDENTIFIER					 {1}
	;

modifiers
	: modifier {1}
	| modifiers modifier {1}
	;

modifier
	: ABSTRACT {1}
	| FINAL {1}
	| PUBLIC {1}
	| PROTECTED {1}
	| PRIVATE {1}
	| STATIC {1}
	| TRANSIENT {1}
	| VOLATILE {1}
	| NATIVE {1}
	| SYNCHRONIZED {1}
	;

class_word
	: CLASS {1}
	| INTERFACE {1}
	;

interfaces
	: IMPLEMENTS class_name_list {$2}
	;

field_declarations
	: field_declaration_opt_semi {1}
    | field_declarations field_declaration_opt_semi {1}
	;

field_declaration_opt_semi
    : field_declaration {1}
    | field_declaration semi_colons {1}
    ;

field_declaration
	: field_variable_declaration SEMICOLON {1}
	| method_declaration {1}
	| constructor_declaration {1}
	| static_initializer {1}
    | non_static_initializer {1}
    | type_declaration {1}
	;

field_variable_declaration
	: modifiers type_specifier variable_declarators {1}
	|           type_specifier variable_declarators {1}
	;

variable_declarators
	: variable_declarator {1}
	| variable_declarators COMMA variable_declarator {1}
	;

variable_declarator
	: declarator_name {1}
	| declarator_name OP_ASSIGN variable_initializer {1}
	;

variable_initializer
	: expression {1}
	| LCBRACK RCBRACK {1}
    | LCBRACK array_initializers RCBRACK {1}
    ;

array_initializers
	: variable_initializer {1}
	| array_initializers COMMA variable_initializer {1}
	| array_initializers COMMA {1}
	;

method_declaration
	: modifiers type_specifier method_declarator throws method_body {1}
	| modifiers type_specifier method_declarator        method_body {1}
	|           type_specifier method_declarator throws method_body {1}
	|           type_specifier method_declarator        method_body {1}
	;

method_declarator
	: declarator_name LPAREN parameter_list RPAREN {1}
	| declarator_name LPAREN RPAREN {1}
	| method_declarator OP_DIM {1}
	;

parameter_list
	: parameter {1}
	| parameter_list COMMA parameter {1}
	;

parameter
	: type_specifier declarator_name {1}
    | FINAL type_specifier declarator_name {1}
	;

declarator_name
	: IDENTIFIER {1}
    | declarator_name OP_DIM {1}
    ;

throws
	: THROWS class_name_list {$2}
	;

method_body
	: block {1}
	| SEMICOLON {1}
	;

constructor_declaration
	: modifiers constructor_declarator throws block {1}
	| modifiers constructor_declarator        block {1}
	|           constructor_declarator throws block {1}
	|           constructor_declarator        block {1}
	;

constructor_declarator
	: IDENTIFIER LPAREN parameter_list RPAREN {1}
	| IDENTIFIER LPAREN RPAREN {1}
	;

static_initializer
	: STATIC block {1}
	;

non_static_initializer
    : block {1}
    ;

extends
	: EXTENDS type_name { [ $2 ] }
	| extends COMMA type_name { List.append $1 [ $3 ] }
	;

block
	: LCBRACK local_variable_declarations_and_statements RCBRACK {1}
	| LCBRACK RCBRACK {1}
    ;

local_variable_declarations_and_statements
	: local_variable_declaration_or_statement {1}
	| local_variable_declarations_and_statements local_variable_declaration_or_statement {1}
	;

local_variable_declaration_or_statement
	: local_variable_declaration_statement {1}
	| statement {1}
	;

local_variable_declaration_statement
	: type_specifier variable_declarators SEMICOLON {1}
    | FINAL type_specifier variable_declarators SEMICOLON {1}
	;

statement
	: empty_statement {1}
	| label_statement {1}
	| expression_statement SEMICOLON {1}
    | selection_statement {1}
    | iteration_statement {1}
	| jump_statement {1}
	| guarding_statement {1}
	| block {1}
	;

empty_statement
	: SEMICOLON {1}
    ;

label_statement
	: IDENTIFIER COLON {1}
    | CASE constant_expression COLON {1}
	| DEFAULT COLON {1}
    ;

expression_statement
	: expression {1}
	;

selection_statement
	: IF LPAREN expression RPAREN statement {1}
    | IF LPAREN expression RPAREN statement ELSE statement {1}
    | SWITCH LPAREN expression RPAREN block {1}
    ;

iteration_statement
	: WHILE LPAREN expression RPAREN statement {1}
	| DO statement WHILE LPAREN expression RPAREN SEMICOLON {1}
	| FOR LPAREN for_init for_expr for_incr RPAREN statement {1}
	| FOR LPAREN for_init for_expr          RPAREN statement {1}
	;

for_init
	: expression_statements SEMICOLON {1}
	| local_variable_declaration_statement {1}
	| SEMICOLON {1}
	;

for_expr
	: expression SEMICOLON {1}
	| SEMICOLON {1}
	;

for_incr
	: expression_statements {1}
	;

expression_statements
	: expression_statement {1}
	| expression_statements COMMA expression_statement {1}
	;

jump_statement
	: BREAK IDENTIFIER SEMICOLON {1}
	| BREAK            SEMICOLON {1}
    | CONTINUE IDENTIFIER SEMICOLON {1}
	| CONTINUE            SEMICOLON {1}
	| RETURN expression SEMICOLON {1}
	| RETURN            SEMICOLON {1}
	| THROW expression SEMICOLON {1}
	| GOTO IDENTIFIER SEMICOLON {1}
	;

guarding_statement
	: SYNCHRONIZED LPAREN expression RPAREN statement {1}
	| TRY block finally {1}
	| TRY block catches {1}
	| TRY block catches finally {1}
	;

catches
	: catch {1}
	| catches catch {1}
	;

catch
	: catch_header block {1}
	;

catch_header
	: CATCH LPAREN type_specifier IDENTIFIER RPAREN {1}
	| CATCH LPAREN type_specifier RPAREN {1}
	;

finally
	: FINALLY block {1}
	;

primary_expression
	: qualified_name {1}
	| not_just_name {1}
	;

not_just_name
	: special_name {1}
	| new_allocation_expression {1}
	| complex_primary {1}
	;

complex_primary
	: LPAREN expression RPAREN {1}
	| complex_primary_no_parenthesis {1}
	;

complex_primary_no_parenthesis
	: LITERAL {1}
	| array_access {1}
	| field_access {1}
	| method_call {1}
	;

array_access
	: qualified_name LBRACK expression RBRACK {1}
	| complex_primary LBRACK expression RBRACK {1}
	;

field_access
	: not_just_name PERIOD IDENTIFIER {1}
	| real_postfix_expression PERIOD IDENTIFIER {1}
    | qualified_name PERIOD THIS {1}
    | qualified_name PERIOD CLASS {1}
    | primitive_type PERIOD CLASS {1}
	;

method_call
	: method_access LPAREN argument_list RPAREN {1}
	| method_access LPAREN RPAREN {1}
	;

method_access
	: complex_primary_no_parenthesis {1}
	| special_name {1}
	| qualified_name {1}
	;

special_name
	: THIS {1}
	| SUPER {1}
	| JNULL {1}
	;

argument_list
	: expression {1}
	| argument_list COMMA expression {1}
	;

new_allocation_expression
    : plain_new_allocation_expression {1}
    | qualified_name PERIOD plain_new_allocation_expression {1}
    ;

plain_new_allocation_expression
  	: array_allocation_expression {1}
   	| class_allocation_expression {1}
   	| array_allocation_expression LCBRACK RCBRACK {1}
   	| class_allocation_expression LCBRACK RCBRACK {1}
   	| array_allocation_expression LCBRACK array_initializers RCBRACK {1}
   	| class_allocation_expression LCBRACK field_declarations RCBRACK {1}
   	;

class_allocation_expression
	: NEW type_name LPAREN argument_list RPAREN %prec OBJECT_ALLOC {1}
	| NEW type_name LPAREN               RPAREN %prec OBJECT_ALLOC {1}
    ;

array_allocation_expression
	: NEW type_name dim_exprs dims {1}
	| NEW type_name dim_exprs {1}
    | NEW type_name dims {1}
	;

dim_exprs
	: dim_expr {1}
	| dim_exprs dim_expr {1}
	;

dim_expr
	: LBRACK expression RBRACK {1}
	;

dims
	: OP_DIM {1}
	| dims OP_DIM {1}
	;

postfix_expression
	: primary_expression {1}
	| real_postfix_expression {1}
	;

real_postfix_expression
	: postfix_expression OP_INC %prec INC_DEC {1}
	| postfix_expression OP_DEC %prec INC_DEC {1}
	;

unary_expression
	: OP_INC unary_expression %prec INC_DEC {1}
	| OP_DEC unary_expression %prec INC_DEC {1}
	| arithmetic_unary_operator cast_expression %prec ARITHM_UNARY {1}
	| logical_unary_expression {1}
	;

logical_unary_expression
	: postfix_expression {1}
	| logical_unary_operator unary_expression  %prec LOGICAL_UNARY {1}
	;

logical_unary_operator
	: OP_NOT {1}
	| OP_LNOT {1}
	;

arithmetic_unary_operator
	: PLUS {1}
	| MINUS {1}
	;

cast_expression
	: unary_expression {1}
	| LPAREN primitive_type_expression RPAREN cast_expression %prec TYPE_CONV {1}
	| LPAREN class_type_expression RPAREN cast_expression %prec TYPE_CONV {1}
	| LPAREN expression RPAREN logical_unary_expression %prec TYPE_CONV {1}
	;

primitive_type_expression
	: primitive_type {1}
    | primitive_type dims {1}
    ;

class_type_expression
	: qualified_name dims {1}
    ;

multiplicative_expression
	: cast_expression {1}
	| multiplicative_expression ASTERISK cast_expression {1}
	| multiplicative_expression OP_DIV cast_expression {1}
	| multiplicative_expression OP_MOD cast_expression {1}
	;

additive_expression
	: multiplicative_expression {1}
    | additive_expression PLUS multiplicative_expression {1}
	| additive_expression MINUS multiplicative_expression {1}
    ;

shift_expression
	: additive_expression {1}
    | shift_expression OP_SHL additive_expression {1}
    | shift_expression OP_SHR additive_expression {1}
    | shift_expression OP_SHRR additive_expression {1}
	;

relational_expression
	: shift_expression {1}
    | relational_expression OP_LT shift_expression {1}
	| relational_expression OP_GT shift_expression {1}
	| relational_expression OP_LE shift_expression {1}
	| relational_expression OP_GE shift_expression {1}
	| relational_expression INSTANCEOF type_specifier {1}
	;

equality_expression
	: relational_expression {1}
    | equality_expression OP_EQ relational_expression {1}
    | equality_expression OP_NE relational_expression {1}
    ;

and_expression
	: equality_expression {1}
    | and_expression OP_AND equality_expression {1}
    ;

exclusive_or_expression
	: and_expression {1}
	| exclusive_or_expression OP_XOR and_expression {1}
	;

inclusive_or_expression
	: exclusive_or_expression {1}
	| inclusive_or_expression OP_OR exclusive_or_expression {1}
	;

conditional_and_expression
	: inclusive_or_expression {1}
	| conditional_and_expression OP_LAND inclusive_or_expression {1}
	;

conditional_or_expression
	: conditional_and_expression {1}
	| conditional_or_expression OP_LOR conditional_and_expression {1}
	;

conditional_expression
	: conditional_or_expression {1}
	| conditional_or_expression OP_AIF expression COLON conditional_expression %prec BOOLEAN_IF {1}
	;

assignment_expression
	: conditional_expression {1}
	| unary_expression assignment_operator assignment_expression {1}
	;

assignment_operator
	: OP_ASSIGN {1}
	| ASS_MUL {1}
	| ASS_DIV {1}
	| ASS_MOD {1}
	| ASS_ADD {1}
	| ASS_SUB {1}
	| ASS_SHL {1}
	| ASS_SHR {1}
	| ASS_SHRR {1}
	| ASS_AND {1}
	| ASS_XOR {1}
	| ASS_OR {1}
	;

expression
	: assignment_expression {1}
    ;

constant_expression
	: conditional_expression {1}
	;

%%

[-- Attachment #3: java11_l.mll --]
[-- Type: application/octet-stream, Size: 5693 bytes --]

{
open Java11_y (* The type token is defined in parser.mli *)
exception Eof
}

let jHexDigit = ['0'-'9''a'-'f''A'-'F']
let jDigit = ['0'-'9']
let jOctalDigit = ['0'-'7']
let jTetraDigit = ['0'-'3']
let jNonZeroDigit = ['1'-'9']
let jLetter = ['a'-'z''A'-'Z''_']
let jAnyButSlash = [^'/']
let jAnyButAstr = [^'*']
let jBLANK = ' '
let jBLK = '\b'
let jTAB = '\t'
(* let jFF = '\f' *)
let jESCCHR = '\\'
let jCR = '\r'
let jLF = '\n'
(* let jUniEsc = '\1b' *)

let jUniEsc = '\\''u' jHexDigit jHexDigit jHexDigit jHexDigit
let jOctEscape1 = '\\' jOctalDigit
let jOctEscape2 = '\\' jOctalDigit jOctalDigit
let jOctEscape3 = '\\' jTetraDigit jOctalDigit jOctalDigit
let jOctEscape = jOctEscape1 | jOctEscape2 | jOctEscape3

let jEscape = '\\' ['r''n''b''f''t''\\''\'''"']
let jULetter = jLetter | jUniEsc
let jIdentifier = jULetter (jULetter | jDigit)*

let jComment1 = '/''*' (jAnyButAstr | '*' jAnyButSlash)* '*''/'
let jComment2 = '/' '/' [^'\r''\n']*
let jComment = jComment1 | jComment2

let jDimension = '[' (jCR | jLF | jTAB | jBLK | jBLANK | jComment)* ']'

let jIntSuffix = ['l''L']
let jDecimalNum = jNonZeroDigit jDigit* jIntSuffix?
let jOctalNum = '0' jOctalDigit* jIntSuffix?
let jHexNum = '0' ['x''X'] jHexDigit jHexDigit* jIntSuffix?
let jIntegerLiteral = jDecimalNum | jOctalNum | jHexNum

let jSign = ['+''-']
let jFlSuffix = ['f''F''d''D']
let jSignedInt = jSign? jDigit+
let jExpo = ['e''E']
let jExponentPart = jExpo jSignedInt?
let jFloat1 = jDigit+ '.' jDigit+? jExponentPart? jFlSuffix?
let jFloat2 = '.' jDigit+ jExponentPart? jFlSuffix?
let jFloat3 = jDigit+ jExponentPart jFlSuffix?
let jFloat4 = jDigit+ jFlSuffix
let jFloatingPoint = jFloat1 | jFloat2 | jFloat3 | jFloat4

let jAnyChrChr = [^'\'''\\']
let jAnyStrChr = [^'"''\\']
let jCharacter = '\'' (jEscape | jOctEscape | jUniEsc | jAnyChrChr) '\''
let jString = '"' (jEscape | jOctEscape | jUniEsc | jAnyStrChr)* '"'
let jNumeric = jIntegerLiteral | jFloatingPoint
let jLiteral = jNumeric | jCharacter | jString

let jOP_AIF = '?'
let jOP_XOR = '^'         
let jPLUS = '+'			
let jASTERISK = '*'			
let jOP_DIV = '/'			
let jMINUS = '-'			
let jLCBRACK = '{'			
let jRCBRACK = '}'			
let jLBRACK = '['			
let jRBRACK = ']'			
let jLPAREN = '('			
let jRPAREN = ')'			
let jCOMMA = ','			
let jPERIOD = '.'			
let jCOLON = ':'			
let jSEMICOLON = ';'			
let jOP_ASSIGN = '='			
let jOP_LT = '<'			
let jOP_GT = '>'			
let jOP_NOT = '~'			
let jOP_LNOT = '!'			
let jOP_MOD = '%'			
let jOP_OR = '|'			
let jOP_AND = '&'			

rule token = parse
    "true"	{ LITERAL(Lexing.lexeme lexbuf) }
  | "false"	{ LITERAL(Lexing.lexeme lexbuf) }
  | jDimension	{ OP_DIM }
  | "=="		{ OP_EQ }
  | "<="		{ OP_LE }
  | ">="		{ OP_GE }
  | "!="		{ OP_NE }
  | "||"		{ OP_LOR }
  | "&&"		{ OP_LAND }
  | "++"		{ OP_INC }
  | "--"		{ OP_DEC }
  | ">>"		{ OP_SHR }
  | "<<"		{ OP_SHL }
  | ">>>"		{ OP_SHRR }
  | "+="		{ ASS_ADD }
  | "-="		{ ASS_SUB }
  | "*="		{ ASS_MUL }
  | "/="		{ ASS_DIV }
  | "&="		{ ASS_AND }
  | "|="		{ ASS_OR }
  | "^="		{ ASS_XOR }
  | "%="		{ ASS_MOD }
  | "<<="		{ ASS_SHL }
  | ">>="		{ ASS_SHR }
  | ">>>="		{ ASS_SHRR }
  | jOP_AIF     { OP_AIF }
  | jOP_XOR     { OP_XOR }
  | jPLUS       { PLUS }
  | jASTERISK   { ASTERISK }
  | jOP_DIV     { OP_DIV }
  | jMINUS      { MINUS }
  | jLCBRACK    { LCBRACK }
  | jRCBRACK    { RCBRACK }
  | jLBRACK     { LBRACK }
  | jRBRACK     { RBRACK }
  | jLPAREN     { LPAREN }
  | jRPAREN     { RPAREN }
  | jCOMMA      { COMMA }
  | jPERIOD     { PERIOD }
  | jCOLON      { COLON }
  | jSEMICOLON  { SEMICOLON }
  | jOP_ASSIGN  { OP_ASSIGN }
  | jOP_LT      { OP_LT }
  | jOP_GT      { OP_GT }
  | jOP_NOT     { OP_NOT }
  | jOP_LNOT    { OP_LNOT }
  | jOP_MOD     { OP_MOD }
  | jOP_OR      { OP_OR }
  | jOP_AND     { OP_AND }
  | "abstract"	{ ABSTRACT }
  | "do"        { DO }
  | "implements"    { IMPLEMENTS }
  | "package"	{ PACKAGE }
  | "throw"		{ THROW }
  | "boolean"	{ BOOLEAN }
  | "double"	{ DOUBLE }
  | "import"	{ IMPORT }
  | "private"	{ PRIVATE }
  | "throws"	{ THROWS }
  | "break"		{ BREAK }
  | "else"		{ ELSE }
  | "protected"	{ PROTECTED }
  | "transient"	{ TRANSIENT }
  | "byte"		{ BYTE }
  | "extends"	{ EXTENDS }
  | "instanceof"	{ INSTANCEOF }
  | "public"	{ PUBLIC }
  | "try"		{ TRY }
  | "case"		{ CASE }
  | "final"		{ FINAL }
  | "int"		{ INT }
  | "finally"	{ FINALLY }
  | "interface"	{ INTERFACE }
  | "return"	{ RETURN }
  | "void"		{ VOID }
  | "catch"		{ CATCH }
  | "float"		{ FLOAT }
  | "long"		{ LONG }
  | "short"		{ SHORT }
  | "volatile"	{ VOLATILE }
  | "char"		{ CHAR }
  | "for"		{ FOR }
  | "native"	{ NATIVE }
  | "static"	{ STATIC }
  | "while"		{ WHILE }
  | "class"		{ CLASS }
  | "new"		{ NEW }
  | "super"		{ SUPER }
  | "const"		{ CONST }
  | "null"		{ JNULL }
  | "switch"	{ SWITCH }
  | "continue"	{ CONTINUE }
  | "goto"		{ GOTO }
  | "synchronized"	{ SYNCHRONIZED }
  | "default"	{ DEFAULT }
  | "if"		{ IF }
  | "this"		{ THIS }

(*
  | "cast"		{ CAST } 
  | "future"	{ FUTURE }
  | "generic"	{ GENERIC }
  | "inner"		{ INNER }
  | "operator"	{ OPERATOR }
  | "outer"		{ OUTER }
  | "rest"		{ REST }
  | "var"		{ VAR }
*)

  | jIdentifier	{ IDENTIFIER(Lexing.lexeme lexbuf) }
  | jDecimalNum { LITERAL(Lexing.lexeme lexbuf) }
  | jOctalNum   { LITERAL(Lexing.lexeme lexbuf) }
  | jHexNum     { LITERAL(Lexing.lexeme lexbuf) }
  | jFloatingPoint { LITERAL(Lexing.lexeme lexbuf) } 
  | jCharacter  { LITERAL(Lexing.lexeme lexbuf) }
  | jString 	{ LITERAL(Lexing.lexeme lexbuf) }
  | jCR   		{ token lexbuf }
  | jLF 		{ token lexbuf }
(*  | jFF 		{} *)
  | jTAB		{ token lexbuf }
  | jBLK        { token lexbuf }
  | jBLANK 		{ token lexbuf }
  | jComment 	{ token lexbuf }
  | eof 		{ raise Eof }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-07-22  8:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-21 21:05 [Caml-list] RE: parsing Java with ocamllex/yacc Serguei Ouklonski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).