~ubuntu-branches/ubuntu/hardy/ocaml-doc/hardy

« back to all changes in this revision

Viewing changes to examples/pascal/envir.ml

  • Committer: Bazaar Package Importer
  • Author(s): Samuel Mimram
  • Date: 2007-09-08 01:49:22 UTC
  • mfrom: (0.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070908014922-lvihyehz0ndq7suu
Tags: 3.10-1
* New upstream release.
* Removed camlp4 documentation since it is not up-to-date.
* Updated to standards version 3.7.2, no changes needed.
* Updated my email address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
(***********************************************************************)
2
 
(*                                                                     *)
3
 
(*                           Objective Caml                            *)
4
 
(*                                                                     *)
5
 
(*               Pierre Weis, projet Cristal, INRIA Rocquencourt       *)
6
 
(*                                                                     *)
7
 
(*  Copyright 2001 Institut National de Recherche en Informatique et   *)
8
 
(*  en Automatique.  All rights reserved.  This file is distributed    *)
9
 
(*  only by permission.                                                *)
10
 
(*                                                                     *)
11
 
(***********************************************************************)
12
 
open Syntaxe;;
13
 
 
14
 
type 'a env =
15
 
  { vars : (string * 'a) list;
16
 
    procs : (string * d�cl_proc) list;
17
 
    foncs : (string * d�cl_fonc) list };;
18
 
 
19
 
exception Pas_trouv� of string;;
20
 
 
21
 
let environnement_initial p f =
22
 
  { vars = []; procs = p; foncs = f };;
23
 
 
24
 
let ajoute_variable nom info env =
25
 
  { vars = (nom,info) :: env.vars; procs = env.procs; foncs = env.foncs };;
26
 
 
27
 
let cherche nom liste =
28
 
  try List.assoc nom liste with Not_found -> raise(Pas_trouv� nom);;
29
 
 
30
 
let cherche_variable nom env = cherche nom env.vars
31
 
and cherche_fonction nom env = cherche nom env.foncs
32
 
and cherche_proc�dure nom env = cherche nom env.procs;;