Version française
Home     About     Download     Resources     Contact us    
Browse thread
dypgen : a generator of dynamically extensible parsers for OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Emmanuel Onzon <emmanuel.onzon@e...>
Subject: dypgen : a generator of dynamically extensible parsers for OCaml
Hello,

dypgen is a GLR parser generator for Objective Caml. It can generate dynamically
extensible parsers.

The program is available at :
http://perso.ens-lyon.fr/emmanuel.onzon

Here is are two examples of extension of a small language.
This is the example included with the program.

define
  list_content := expr(x) = List(x,Nil)
  and list_content := expr(x);list_content(y) = List(x,y)
  and expr := [] = Nil
  and expr := [list_content(x)] = x
  and expr := expr(x)::expr(y) = List(x,y)
in
match [1;2;3] with
  | a::[b;c] -> b
  | _ -> 4


define
  expr := | expr(x) | = Node(Leaf,x,Leaf)
  and expr := expr(x) | expr(y) | = Node(x,y,Leaf)
  and expr := | expr(x) | expr(y) = Node(Leaf,x,y)
  and expr := expr(x) | expr(y) | expr(z) = Node(x,y,z)
in
match Node(Leaf,3,Node(Node(Leaf,7,Leaf),5,Node(Leaf,1,Leaf))) with
  | (|3|((|7|)|a|(|1|))) -> a
  | _ -> 8