Louis Cadet avatar Louis Cadet committed 03b869e

oups

Comments (0)

Files changed (26)

MiniProj/_build/_digests

-"Rule: ocaml: ml -> cmo & cmi (%=main )": "D=\150.\140\018\248\194\127\232\193\211}\000\2040"
-"Rule: ocaml dependencies mli (%=ast )": "\167\216\229\155\006\220\167\014\018FKF\133\146\156Z"
-"Resource: /home/fumbo/Documents/Caml/MiniProj/parser.mly": "\189\178\144he\027\246\227\1635PR\029\011\145\198"
-"Rule: ocaml: ml -> cmo & cmi (%=lexer )": "\242\166\217\017\003\249\252\223>\181b,\230(\241r"
-"Rule: ocaml dependencies ml (%=parser )": "\\0\017\bA-t]9\212\239\205%\203\024\209"
-"Rule: ocaml: ml & cmi -> cmx & o (%=lexer )": "F_\170\145>\163P\161h\171HX\208W*\002"
-"Rule: ocamllex (%=lexer )": "c!e\211\127Z\019\238\187\163A@AEnW"
-"Rule: ocaml dependencies ml (%=lexer )": "\154\157\161Vk\189\176@\194D\246\144N\003\250\142"
-"Rule: ocaml: ml & cmi -> cmx & o (%=parser )": "\157\198\225\227\246EM\026\183\199\n>\147Xc`"
-"Rule: ocaml: ml & cmi -> cmx & o (%=main )": "B\183\000\157\128_YH\191\219\158\157\151\222\002\226"
-"Resource: /home/fumbo/Documents/Caml/MiniProj/main.ml": "\014\213\194b\t\143\163\150\196\017\155\2190\004\172R"
-"Rule: ocaml: mli -> cmi (%=ast )": "\132\146\025\187&P;\149\203~\024\199\150\238o\220"
-"Resource: /home/fumbo/Documents/Caml/MiniProj/ast.mli": "\202H\214\246\129\214\025\023\015\131\174\028z\189\237\232"
-"Rule: ocaml: cmx* & o* -> native (%=main )": "@\007\252;M\236\190\1892\246?\197\147\163#H"
-"Rule: ocaml dependencies ml (%=main )": "\171\235\236\190\1289\203\138\006\127\213\154\244\147\190\000"
-"Rule: ocaml dependencies mli (%=parser )": "\158\00775\250\028\r\187\217\028k\254F\250\131\165"
-"Rule: ocaml: mli -> cmi (%=parser )": "w\135\183\174CJ\181\1631\239Z\134a\138DD"
-"Rule: ocamlyacc (%=parser )": "~\011<\186\221'asN\177a\190\155=\164\193"
-"Resource: /home/fumbo/Documents/Caml/MiniProj/lexer.mll": "\216\031\205K3\150#\021\242\197*P\139\217\206\200"

MiniProj/_build/_log

-### Starting build.
-# Target: main.ml.depends, tags: { extension:ml, file:main.ml, ocaml, ocamldep, quiet }
-/usr/bin/ocamldep -modules main.ml > main.ml.depends
-# Target: ast.mli.depends, tags: { extension:mli, file:ast.mli, ocaml, ocamldep, quiet }
-/usr/bin/ocamldep -modules ast.mli > ast.mli.depends # cached
-# Target: ast.cmi, tags: { byte, compile, extension:mli, file:ast.mli, interf, ocaml, quiet }
-/usr/bin/ocamlc -c -o ast.cmi ast.mli # cached
-# Target: lexer.mll, tags: { extension:mll, file:lexer.mll, lexer, ocaml, ocamllex, quiet }
-/usr/bin/ocamllex -q lexer.mll # cached
-# Target: lexer.ml.depends, tags: { extension:ml, file:lexer.ml, ocaml, ocamldep, quiet }
-/usr/bin/ocamldep -modules lexer.ml > lexer.ml.depends # cached
-# Target: parser.mly, tags: { extension:mly, file:parser.mly, ocaml, ocamlyacc, parser, quiet }
-/usr/bin/ocamlyacc parser.mly # cached
-# Target: parser.mli.depends, tags: { extension:mli, file:parser.mli, ocaml, ocamldep, quiet }
-/usr/bin/ocamldep -modules parser.mli > parser.mli.depends # cached
-# Target: parser.cmi, tags: { byte, compile, extension:mli, file:parser.mli, interf, ocaml, quiet }
-/usr/bin/ocamlc -c -o parser.cmi parser.mli # cached
-# Target: lexer.cmo, tags: { byte, compile, extension:cmo, extension:ml, file:lexer.cmo, file:lexer.ml, implem, ocaml, quiet }
-/usr/bin/ocamlc -c -o lexer.cmo lexer.ml # cached
-# Target: main.cmo, tags: { byte, compile, extension:cmo, extension:ml, file:main.cmo, file:main.ml, implem, ocaml, quiet }
-/usr/bin/ocamlc -c -o main.cmo main.ml
-+ /usr/bin/ocamlc -c -o main.cmo main.ml
-File "main.ml", line 98, characters 23-940:
-Warning 8: this pattern-matching is not exhaustive.
-Here is an example of a value that is not matched:
-""
-File "main.ml", line 111, characters 21-230:
-Warning 8: this pattern-matching is not exhaustive.
-Here is an example of a value that is not matched:
-""
-File "main.ml", line 133, characters 8-574:
-Warning 8: this pattern-matching is not exhaustive.
-Here is an example of a value that is not matched:
-Return _
-File "main.ml", line 133, characters 8-574:
-Warning 10: this expression should have type unit.
-File "main.ml", line 161, characters 23-28:
-Error: This expression has type (string, Ast.funcdecl) Hashtbl.t
-       but an expression was expected of type
-         (string, Ast.statement list) Hashtbl.t
-Command exited with code 2.
-# Compilation unsuccessful.
Add a comment to this file

MiniProj/_build/ast.cmi

Binary file removed.

MiniProj/_build/ast.mli

-(* ast.mli *)
-
-(* Les expressions *)
-type expr =
-  (* valeur entiere directe *)
-  | Int of int
-  (* variable *)
-  | Var of string
-  (* Operateur binaire *)
-  | BinOp of expr * string * expr
-  (* Operateur unaire *)
-  | UniOp of string * expr
-(* Appel de fonction *)
-  | Call of string * expr list
-
-(* Les instructions *)
-type statement =
-  (* Affectation d'une variable *)
-  | Assign of string * expr
-  (* Une expression seule *)
-  | Expr of expr
-  (* if-then-else *)
-  | If of expr * statement list * statement list
-  (* boucle while *)
-  | While of expr * statement list
-  (* return *)
-  | Return of expr
-
-(* Declaration de fonctions *)
-type funcdecl =
-    {
-      (* Le nom de la fonction *)
-      fname : string;
-      (* Le corps de la fonction *)
-      fbody : statement list;
-      (* La liste des parametres *)
-      fparams : string list;
-      (* La liste des variables *)
-      fvars : string list;
-    }
-
-(* Le point d'entree du programme *)
-type entry =
-    {
-      (* Les variables du bloc principal *)
-      mainvars : string list;
-      (* le corps principal *)
-      mainbody : statement list;
-    }
-
-(* Le programme *)
-type prg =
-    {
-      (* Les fonctions *)
-      func : funcdecl list;
-      (* Le point d'entree *)
-      main : entry;
-    }

MiniProj/_build/ast.mli.depends

-ast.mli:
Add a comment to this file

MiniProj/_build/lexer.cmi

Binary file removed.

Add a comment to this file

MiniProj/_build/lexer.cmo

Binary file removed.

Add a comment to this file

MiniProj/_build/lexer.cmx

Binary file removed.

MiniProj/_build/lexer.ml

-# 2 "lexer.mll"
- 
-  open Parser        (* The type token is defined in parser.mli *)
-  exception Eof
-
-  let h = Hashtbl.create 29
-  let _ =
-    List.iter (fun (k,t) -> Hashtbl.add h k t)
-      [
-        ("+",ADD); ("*",MUL);
-        ("-",MIN); ("/",DIV);
-        ("<",LT); (">",GT);
-        ("<=",LEQ); (">=",GEQ);
-        ("==",CMPEQ);(",",COM);
-        ("!",NOT);("&&",AND);("||",OR);
-        ("{",LB); ("}",RB);
-        ("=",EQ); (";",SC);
-        ("(",LPAREN); (")",RPAREN);
-      ]
-
-  let keys = Hashtbl.create 13
-  let _ =
-    List.iter (fun (k,t) -> Hashtbl.add keys k t)
-      [
-        ("main",MAIN);
-        ("if",IF);
-        ("while",WHILE);
-        ("else",ELSE);
-        ("return",RETURN);
-        ("vars",VARS);
-      ]
-
-
-# 35 "lexer.ml"
-let __ocaml_lex_tables = {
-  Lexing.lex_base = 
-   "\000\000\251\255\001\000\002\000\252\255\002\000\003\000\004\000\
-    \032\000\018\000\107\000\002\000";
-  Lexing.lex_backtrk = 
-   "\255\255\255\255\255\255\255\255\255\255\003\000\003\000\003\000\
-    \002\000\001\000\003\000\000\000";
-  Lexing.lex_default = 
-   "\255\255\000\000\255\255\255\255\000\000\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255";
-  Lexing.lex_trans = 
-   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\011\000\011\000\011\000\011\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \011\000\004\000\011\000\000\000\000\000\000\000\002\000\004\000\
-    \004\000\004\000\004\000\004\000\004\000\010\000\000\000\004\000\
-    \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\
-    \009\000\009\000\000\000\004\000\007\000\005\000\006\000\004\000\
-    \004\000\004\000\009\000\009\000\009\000\009\000\009\000\009\000\
-    \009\000\009\000\009\000\009\000\000\000\000\000\000\000\000\000\
-    \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\
-    \008\000\008\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\
-    \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\
-    \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\
-    \008\000\008\000\008\000\004\000\003\000\004\000\004\000\008\000\
-    \000\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\
-    \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\
-    \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\
-    \008\000\008\000\008\000\009\000\009\000\009\000\009\000\009\000\
-    \009\000\009\000\009\000\009\000\009\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000";
-  Lexing.lex_check = 
-   "\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\000\000\000\000\011\000\011\000\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \000\000\000\000\011\000\255\255\255\255\255\255\000\000\002\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\255\255\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\255\255\000\000\000\000\000\000\000\000\005\000\
-    \006\000\007\000\009\000\009\000\009\000\009\000\009\000\009\000\
-    \009\000\009\000\009\000\009\000\255\255\255\255\255\255\255\255\
-    \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\
-    \008\000\008\000\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-    \000\000\000\000\000\000\000\000\000\000\000\000\003\000\008\000\
-    \255\255\008\000\008\000\008\000\008\000\008\000\008\000\008\000\
-    \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\
-    \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\
-    \008\000\008\000\008\000\010\000\010\000\010\000\010\000\010\000\
-    \010\000\010\000\010\000\010\000\010\000\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \000\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
-    \255\255\255\255\255\255\255\255";
-  Lexing.lex_base_code = 
-   "";
-  Lexing.lex_backtrk_code = 
-   "";
-  Lexing.lex_default_code = 
-   "";
-  Lexing.lex_trans_code = 
-   "";
-  Lexing.lex_check_code = 
-   "";
-  Lexing.lex_code = 
-   "";
-}
-
-let rec token lexbuf =
-    __ocaml_lex_token_rec lexbuf 0
-and __ocaml_lex_token_rec lexbuf __ocaml_lex_state =
-  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
-      | 0 ->
-# 44 "lexer.mll"
-                   ( token lexbuf )
-# 161 "lexer.ml"
-
-  | 1 ->
-let
-# 45 "lexer.mll"
-            n
-# 167 "lexer.ml"
-= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
-# 45 "lexer.mll"
-                   ( INT (int_of_string n) )
-# 171 "lexer.ml"
-
-  | 2 ->
-let
-# 46 "lexer.mll"
-             ato
-# 177 "lexer.ml"
-= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
-# 46 "lexer.mll"
-                   (
-    try Hashtbl.find keys ato with
-      | Not_found -> VAR ato
-  )
-# 184 "lexer.ml"
-
-  | 3 ->
-# 50 "lexer.mll"
-                   ( Hashtbl.find h (Lexing.lexeme lexbuf))
-# 189 "lexer.ml"
-
-  | 4 ->
-# 51 "lexer.mll"
-                   ( EOF )
-# 194 "lexer.ml"
-
-  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_token_rec lexbuf __ocaml_lex_state
-
-;;
-

MiniProj/_build/lexer.ml.depends

-lexer.ml: Hashtbl Lexing List Parser

MiniProj/_build/lexer.mll

-(* File lexer.mll *)
-{
-  open Parser        (* The type token is defined in parser.mli *)
-  exception Eof
-
-  let h = Hashtbl.create 29
-  let _ =
-    List.iter (fun (k,t) -> Hashtbl.add h k t)
-      [
-        ("+",ADD); ("*",MUL);
-        ("-",MIN); ("/",DIV);
-        ("<",LT); (">",GT);
-        ("<=",LEQ); (">=",GEQ);
-        ("==",CMPEQ);(",",COM);
-        ("!",NOT);("&&",AND);("||",OR);
-        ("{",LB); ("}",RB);
-        ("=",EQ); (";",SC);
-        ("(",LPAREN); (")",RPAREN);
-      ]
-
-  let keys = Hashtbl.create 13
-  let _ =
-    List.iter (fun (k,t) -> Hashtbl.add keys k t)
-      [
-        ("main",MAIN);
-        ("if",IF);
-        ("while",WHILE);
-        ("else",ELSE);
-        ("return",RETURN);
-        ("vars",VARS);
-      ]
-
-}
-let ident = ['a'-'z']['a'-'z' '_' '0'-'9']*
-
-let white = [' ' '\t' '\n']
-
-let num = '-'?['0'-'9']['0'-'9']*
-
-let op = "+" | "*" | "-" | "/" | "<" | ">" | ">=" | "<=" | "=="
-  | "," | "{" | "}" | "=" | ";" | "(" | ")" | "!" | "||" | "&&"
-
-rule token = parse
-    white+         { token lexbuf }     (* skip blanks *)
-  | num  as n      { INT (int_of_string n) }
-  | ident as ato   {
-    try Hashtbl.find keys ato with
-      | Not_found -> VAR ato
-  }
-  | op             { Hashtbl.find h (Lexing.lexeme lexbuf)}
-  | eof            { EOF }
Add a comment to this file

MiniProj/_build/lexer.o

Binary file removed.

Add a comment to this file

MiniProj/_build/main.cmx

Binary file removed.

MiniProj/_build/main.ml

-open Ast
-
-let print_params f l =
-    let rec print_list_rec li = match li with
-        | [] -> Printf.printf ")"
-        | e::[] -> f e; Printf.printf ")"
-        | e::l -> f e; Printf.printf ","; print_list_rec l
-    in 
-        Printf.printf "("; print_list_rec l
-
-let rec print_expr = function
-    | Int a -> Printf.printf "%i" a
-    | Var s -> Printf.printf "%s" s
-    | BinOp (a,s,b) -> print_expr a; Printf.printf " %s " s; print_expr b
-    | UniOp (s,a) -> Printf.printf "%s" s; print_expr a
-    | Call (s,l) -> Printf.printf "%s" s; print_params print_expr l
-
-let rec print_statement_list f = function
-    | [] -> ()
-    | e::l -> f e; print_statement_list f l
-
-let rec print_statement = function
-    | Assign (s,expr) -> Printf.printf "%s = " s; print_expr expr;
-                         print_endline ";"
-    | Expr expr -> print_expr expr; print_endline ";"
-    | If (expr,l1,[]) -> Printf.printf "if (";
-                         print_expr expr; print_endline ")";
-                         print_endline "{";
-                         print_statement_list print_statement l1;
-                         print_endline "}";
-    | If (expr,l1,l2) -> Printf.printf "if (";
-                         print_expr expr; print_endline ")";
-                         print_endline "{";
-                         print_statement_list print_statement l1;
-                         print_endline "}";
-                         print_endline "else";
-                         print_endline "{";
-                         print_statement_list print_statement l2;
-                         print_endline "}"
-    | While (expr,l) -> Printf.printf "while (";
-                        print_expr expr; print_endline ")";
-                        print_endline "{";
-                        print_statement_list print_statement l;
-                        print_endline "}"
-    | Return expr -> Printf.printf "return "; print_expr expr; print_endline ";"
-
-let rec print_fbody = function
-    | [] -> ()
-    | e::l -> print_statement e; print_fbody l
-
-let print_fparams l =
-    let rec print_list_rec li = match li with
-         | [] -> print_endline ")"
-        | e::[] -> Printf.printf "%s" e; print_endline ")"
-        | e::l -> Printf.printf "%s," e; print_list_rec l
-    in 
-        Printf.printf "("; print_list_rec l
-
-let print_fvars l =
-    let rec print_list_rec li = match li with
-        | [] -> print_endline ";"
-        | e::[] -> Printf.printf "%s" e; print_endline ";"
-        | e::l -> Printf.printf "%s," e; print_list_rec l
-    in 
-        Printf.printf "vars "; print_list_rec l
-
-let rec print_func = function
-    | [] -> ()
-    | e::l -> Printf.printf "%s" e.fname;
-              print_fparams e.fparams;
-              print_endline "{";
-              print_fvars e.fvars;
-              print_fbody e.fbody;
-              print_endline "}";
-              print_newline ();
-              print_func l
-
-let print_main a =
-    begin
-        print_endline "main()";
-        print_endline "{";
-        print_fvars a.mainvars;
-        print_fbody a.mainbody;
-        print_endline "}";
-    end
-
-let printer a =
-    begin
-        print_func a.func;
-        print_main a.main;
-    end
-
-
-let rec evalstat body hash hash2 =
-    let rec evalexpr hash hash2 = function
-    | Int a -> a
-    | Var s -> Hashtbl.find hash s
-    | BinOp (a,s,b) -> (match s with
-       |"+" -> (evalexpr hash hash2 a) + (evalexpr hash hash2 b)
-       |"-" -> (evalexpr hash hash2 a) - (evalexpr hash hash2 b)
-       |"*" -> (evalexpr hash hash2 a) * (evalexpr hash hash2 b)
-       |"/" -> (evalexpr hash hash2 a) / (evalexpr hash hash2 b)
-       |">" -> if ((evalexpr hash hash2 a) > (evalexpr hash hash2 b)) then 1 else 0
-       |"<" -> if ((evalexpr hash hash2 a) < (evalexpr hash hash2 b)) then 1 else 0
-       |">=" -> if ((evalexpr hash hash2 a) >= (evalexpr hash hash2 b)) then 1 else 0
-       |"<=" -> if ((evalexpr hash hash2 a) <= (evalexpr hash hash2 b)) then 1 else 0
-       |"==" -> if ((evalexpr hash hash2 a) == (evalexpr hash hash2 b)) then 1 else 0
-       |"||" -> (evalexpr hash hash2 a) + (evalexpr hash hash2 b)
-       |"&&" -> (evalexpr hash hash2 a) * (evalexpr hash hash2 b)
-       |"!" -> if ((evalexpr hash hash2 a) <> (evalexpr hash hash2 b)) then 1 else 0)
-    | UniOp (s,a) -> (match s with
-       |"!" -> if (evalexpr hash hash2 a) == 0 then 1 else 0
-       |"-" -> (evalexpr hash hash2 a) * (-1)
-       |"++" -> (evalexpr hash hash2 a) + 1
-       |"--" -> (evalexpr hash hash2 a) - 1)
-    | Call (s, el) -> (
-        match s with
-        |"write" ->
-                if (List.length el == 0) then
-                    1
-                else
-                    begin
-                        for i=0 to (List.length el)-1 do
-                            Printf.printf "%i" (evalexpr hash hash2 (List.nth el i));
-                            print_newline ();
-                        done;
-                        1
-                    end
-        |s  -> evalstat (Hashtbl.find hash2 s) hash hash2; 1
-        |_ -> 1) in
-    let l2 = List.length body in
-    for i = 0 to l2-1 do
-        match (List.nth body i) with
-        (* Evaluer une expression avec variable *)
-        (* Evaluer un appel a "write" *)
-        |Expr expr -> evalexpr hash hash2 expr
-        (* Evaluer une affectation *)
-        |Assign (s, expr) -> Hashtbl.replace hash s (evalexpr hash hash2 expr); 1
-        |If (c, i, e) -> if ((evalexpr hash hash2 c) == 0) then evalstat e hash hash2
-        else evalstat i hash hash2; 1
-        |While (c, d) -> while ((evalexpr hash hash2 c) <> 0) do
-            evalstat d hash hash2
-                        done;
-                        1
-    done
-
-let eval ast = 
-    (* Evaluation des Variables *)
-    let l = List.length ast.main.mainvars in
-    let l2 = List.length ast.func in
-    let hash = Hashtbl.create l in
-    let hash2 = Hashtbl.create l2 in
-    for i=0 to l-1 do
-        Hashtbl.add hash (List.nth ast.main.mainvars i) 0
-    done;
-    for i=0 to l2-1 do
-        Hashtbl.add hash2 (List.nth ast.func i).fname (List.nth ast.func i)
-    done;
-    (* Evaluation du corps du Main *)
-    let body = ast.main.mainbody in
-    evalstat body hash hash2
-
-
-let main () =
-    begin
-        let i = ref 1 in
-        if Array.length (Sys.argv) < 2 then
-            failwith "Il manque le nom du fichier!";
-        if Sys.argv.(1) = "-eval" then
-                i := !i + 1;
-        let cin = open_in Sys.argv.(!i) in
-        let ast = Parser.prg Lexer.token (Lexing.from_channel cin) in
-        if Sys.argv.(1) = "-eval" then
-                eval ast;
-        if Array.length (Sys.argv) = 2 then
-            printer ast;
-        exit 0;
-            end
-
-let _ = main ()

MiniProj/_build/main.ml.depends

-main.ml: Array Ast Hashtbl Lexer Lexing List Parser Printf Sys
Add a comment to this file

MiniProj/_build/main.o

Binary file removed.

MiniProj/_build/ocamlc.where

-/usr/lib/ocaml
Add a comment to this file

MiniProj/_build/parser.cmi

Binary file removed.

Add a comment to this file

MiniProj/_build/parser.cmx

Binary file removed.

MiniProj/_build/parser.ml

-type token =
-  | VAR of (string)
-  | INT of (int)
-  | ADD
-  | MUL
-  | DIV
-  | MIN
-  | LT
-  | GT
-  | LEQ
-  | GEQ
-  | CMPEQ
-  | NOT
-  | AND
-  | OR
-  | LPAREN
-  | RPAREN
-  | RB
-  | LB
-  | EQ
-  | SC
-  | COM
-  | MAIN
-  | IF
-  | WHILE
-  | ELSE
-  | RETURN
-  | VARS
-  | EOF
-
-open Parsing;;
-let yytransl_const = [|
-  259 (* ADD *);
-  260 (* MUL *);
-  261 (* DIV *);
-  262 (* MIN *);
-  263 (* LT *);
-  264 (* GT *);
-  265 (* LEQ *);
-  266 (* GEQ *);
-  267 (* CMPEQ *);
-  268 (* NOT *);
-  269 (* AND *);
-  270 (* OR *);
-  271 (* LPAREN *);
-  272 (* RPAREN *);
-  273 (* RB *);
-  274 (* LB *);
-  275 (* EQ *);
-  276 (* SC *);
-  277 (* COM *);
-  278 (* MAIN *);
-  279 (* IF *);
-  280 (* WHILE *);
-  281 (* ELSE *);
-  282 (* RETURN *);
-  283 (* VARS *);
-    0 (* EOF *);
-    0|]
-
-let yytransl_block = [|
-  257 (* VAR *);
-  258 (* INT *);
-    0|]
-
-let yylhs = "\255\255\
-\001\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
-\004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
-\004\000\004\000\005\000\005\000\006\000\006\000\007\000\007\000\
-\007\000\007\000\007\000\007\000\008\000\008\000\009\000\009\000\
-\010\000\011\000\011\000\012\000\012\000\013\000\013\000\013\000\
-\014\000\002\000\002\000\003\000\000\000"
-
-let yylen = "\002\000\
-\003\000\001\000\001\000\003\000\003\000\003\000\003\000\003\000\
-\003\000\003\000\003\000\003\000\003\000\003\000\002\000\002\000\
-\002\000\003\000\002\000\003\000\001\000\003\000\004\000\002\000\
-\005\000\007\000\005\000\003\000\002\000\003\000\001\000\002\000\
-\003\000\001\000\003\000\002\000\003\000\002\000\003\000\004\000\
-\003\000\000\000\002\000\004\000\002\000"
-
-let yydefred = "\000\000\
-\000\000\000\000\000\000\045\000\000\000\000\000\000\000\000\000\
-\000\000\000\000\043\000\000\000\036\000\000\000\000\000\041\000\
-\000\000\001\000\000\000\037\000\000\000\003\000\000\000\000\000\
-\000\000\038\000\000\000\000\000\000\000\000\000\000\000\000\000\
-\000\000\000\000\000\000\035\000\000\000\000\000\017\000\000\000\
-\015\000\016\000\000\000\000\000\000\000\000\000\000\000\000\000\
-\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-\000\000\000\000\024\000\032\000\039\000\000\000\044\000\019\000\
-\000\000\000\000\000\000\018\000\000\000\000\000\028\000\033\000\
-\000\000\005\000\007\000\000\000\000\000\000\000\000\000\000\000\
-\000\000\000\000\000\000\040\000\000\000\020\000\023\000\000\000\
-\000\000\022\000\000\000\000\000\027\000\029\000\000\000\000\000\
-\030\000\026\000"
-
-let yydgoto = "\002\000\
-\004\000\005\000\010\000\031\000\039\000\066\000\032\000\092\000\
-\033\000\034\000\014\000\008\000\016\000\006\000"
-
-let yysindex = "\023\000\
-\038\255\000\000\025\255\000\000\020\255\038\255\002\255\034\255\
-\040\255\053\000\000\000\037\255\000\000\044\255\042\255\000\000\
-\045\255\000\000\055\255\000\000\245\254\000\000\076\255\076\255\
-\076\255\000\000\048\255\052\255\076\255\055\255\214\255\095\255\
-\056\255\095\255\034\255\000\000\035\255\076\255\000\000\057\255\
-\000\000\000\000\099\000\076\255\076\255\232\255\054\255\076\255\
-\076\255\076\255\076\255\076\255\076\255\076\255\076\255\076\255\
-\076\255\076\255\000\000\000\000\000\000\059\255\000\000\000\000\
-\138\255\063\255\250\255\000\000\113\000\127\000\000\000\000\000\
-\041\255\000\000\000\000\041\255\006\255\006\255\006\255\006\255\
-\006\255\041\255\041\255\000\000\076\255\000\000\000\000\062\255\
-\062\255\000\000\069\255\058\255\000\000\000\000\068\255\062\255\
-\000\000\000\000"
-
-let yyrindex = "\000\000\
-\065\255\000\000\000\000\000\000\000\000\065\255\000\000\000\000\
-\000\000\000\000\000\000\253\254\000\000\000\000\000\000\000\000\
-\000\000\000\000\000\000\000\000\012\000\000\000\000\000\000\000\
-\000\000\000\000\000\000\000\000\000\000\000\000\000\000\081\255\
-\000\000\000\000\000\000\000\000\000\000\000\000\000\000\119\255\
-\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-\083\255\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
-\147\255\000\000\000\000\163\255\020\000\035\000\050\000\065\000\
-\080\000\179\255\195\255\000\000\000\000\000\000\000\000\000\000\
-\000\000\000\000\000\000\088\255\000\000\000\000\000\000\000\000\
-\000\000\000\000"
-
-let yygindex = "\000\000\
-\000\000\096\000\000\000\233\255\000\000\021\000\000\000\183\255\
-\229\255\000\000\019\000\000\000\069\000\000\000"
-
-let yytablesize = 399
-let yytable = "\041\000\
-\042\000\043\000\012\000\037\000\060\000\046\000\062\000\038\000\
-\048\000\049\000\050\000\051\000\034\000\065\000\067\000\093\000\
-\034\000\013\000\057\000\058\000\069\000\070\000\098\000\001\000\
-\073\000\074\000\075\000\076\000\077\000\078\000\079\000\080\000\
-\081\000\082\000\083\000\040\000\022\000\036\000\003\000\007\000\
-\023\000\009\000\021\000\022\000\049\000\050\000\024\000\023\000\
-\047\000\025\000\064\000\015\000\018\000\024\000\017\000\012\000\
-\025\000\019\000\026\000\020\000\035\000\065\000\044\000\095\000\
-\027\000\028\000\045\000\029\000\030\000\021\000\022\000\037\000\
-\061\000\072\000\023\000\084\000\040\000\022\000\086\000\091\000\
-\024\000\023\000\096\000\025\000\097\000\094\000\042\000\024\000\
-\025\000\025\000\025\000\027\000\028\000\025\000\029\000\021\000\
-\022\000\031\000\021\000\025\000\023\000\011\000\025\000\063\000\
-\025\000\090\000\024\000\000\000\000\000\025\000\025\000\025\000\
-\000\000\025\000\000\000\000\000\000\000\027\000\028\000\000\000\
-\029\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\
-\002\000\002\000\000\000\002\000\002\000\000\000\002\000\000\000\
-\000\000\000\000\002\000\002\000\048\000\049\000\050\000\051\000\
-\052\000\053\000\054\000\055\000\056\000\004\000\057\000\058\000\
-\004\000\004\000\004\000\004\000\004\000\004\000\085\000\004\000\
-\004\000\000\000\004\000\000\000\000\000\006\000\004\000\004\000\
-\006\000\006\000\006\000\006\000\006\000\006\000\000\000\006\000\
-\006\000\000\000\006\000\000\000\000\000\013\000\006\000\006\000\
-\013\000\013\000\013\000\013\000\013\000\013\000\000\000\013\000\
-\013\000\000\000\013\000\000\000\000\000\014\000\013\000\013\000\
-\014\000\014\000\014\000\014\000\014\000\014\000\000\000\014\000\
-\014\000\000\000\014\000\000\000\000\000\000\000\014\000\014\000\
-\048\000\049\000\050\000\051\000\052\000\053\000\054\000\055\000\
-\056\000\000\000\057\000\058\000\000\000\000\000\000\000\000\000\
-\000\000\059\000\048\000\049\000\050\000\051\000\052\000\053\000\
-\054\000\055\000\056\000\000\000\057\000\058\000\000\000\000\000\
-\000\000\000\000\000\000\071\000\048\000\049\000\050\000\051\000\
-\052\000\053\000\054\000\055\000\056\000\000\000\057\000\058\000\
-\000\000\000\000\000\000\000\000\000\000\087\000\002\000\002\000\
-\002\000\002\000\002\000\002\000\002\000\002\000\002\000\000\000\
-\002\000\002\000\008\000\008\000\008\000\008\000\008\000\002\000\
-\000\000\000\000\000\000\008\000\000\000\000\000\000\000\008\000\
-\008\000\009\000\009\000\009\000\009\000\009\000\000\000\000\000\
-\000\000\000\000\009\000\000\000\000\000\000\000\009\000\009\000\
-\010\000\010\000\010\000\010\000\010\000\000\000\000\000\000\000\
-\000\000\010\000\000\000\000\000\000\000\010\000\010\000\011\000\
-\011\000\011\000\011\000\011\000\000\000\000\000\000\000\000\000\
-\011\000\000\000\000\000\000\000\011\000\011\000\012\000\012\000\
-\012\000\012\000\012\000\000\000\000\000\000\000\000\000\012\000\
-\000\000\000\000\000\000\012\000\012\000\048\000\049\000\050\000\
-\051\000\052\000\053\000\054\000\055\000\056\000\000\000\057\000\
-\058\000\000\000\068\000\048\000\049\000\050\000\051\000\052\000\
-\053\000\054\000\055\000\056\000\000\000\057\000\058\000\000\000\
-\088\000\048\000\049\000\050\000\051\000\052\000\053\000\054\000\
-\055\000\056\000\000\000\057\000\058\000\000\000\089\000"
-
-let yycheck = "\023\000\
-\024\000\025\000\001\001\015\001\032\000\029\000\034\000\019\001\
-\003\001\004\001\005\001\006\001\016\001\037\000\038\000\089\000\
-\020\001\016\001\013\001\014\001\044\000\045\000\096\000\001\000\
-\048\000\049\000\050\000\051\000\052\000\053\000\054\000\055\000\
-\056\000\057\000\058\000\001\001\002\001\019\000\001\001\015\001\
-\006\001\022\001\001\001\002\001\004\001\005\001\012\001\006\001\
-\030\000\015\001\016\001\018\001\000\000\012\001\015\001\001\001\
-\015\001\021\001\017\001\016\001\016\001\085\000\015\001\091\000\
-\023\001\024\001\015\001\026\001\027\001\001\001\002\001\015\001\
-\017\001\020\001\006\001\017\001\001\001\002\001\016\001\018\001\
-\012\001\006\001\025\001\015\001\017\001\017\001\022\001\012\001\
-\001\001\002\001\015\001\023\001\024\001\006\001\026\001\001\001\
-\002\001\017\001\016\001\012\001\006\001\006\000\015\001\035\000\
-\017\001\085\000\012\001\255\255\255\255\015\001\023\001\024\001\
-\255\255\026\001\255\255\255\255\255\255\023\001\024\001\255\255\
-\026\001\003\001\004\001\005\001\006\001\007\001\008\001\009\001\
-\010\001\011\001\255\255\013\001\014\001\255\255\016\001\255\255\
-\255\255\255\255\020\001\021\001\003\001\004\001\005\001\006\001\
-\007\001\008\001\009\001\010\001\011\001\003\001\013\001\014\001\
-\006\001\007\001\008\001\009\001\010\001\011\001\021\001\013\001\
-\014\001\255\255\016\001\255\255\255\255\003\001\020\001\021\001\
-\006\001\007\001\008\001\009\001\010\001\011\001\255\255\013\001\
-\014\001\255\255\016\001\255\255\255\255\003\001\020\001\021\001\
-\006\001\007\001\008\001\009\001\010\001\011\001\255\255\013\001\
-\014\001\255\255\016\001\255\255\255\255\003\001\020\001\021\001\
-\006\001\007\001\008\001\009\001\010\001\011\001\255\255\013\001\
-\014\001\255\255\016\001\255\255\255\255\255\255\020\001\021\001\
-\003\001\004\001\005\001\006\001\007\001\008\001\009\001\010\001\
-\011\001\255\255\013\001\014\001\255\255\255\255\255\255\255\255\
-\255\255\020\001\003\001\004\001\005\001\006\001\007\001\008\001\
-\009\001\010\001\011\001\255\255\013\001\014\001\255\255\255\255\
-\255\255\255\255\255\255\020\001\003\001\004\001\005\001\006\001\
-\007\001\008\001\009\001\010\001\011\001\255\255\013\001\014\001\
-\255\255\255\255\255\255\255\255\255\255\020\001\003\001\004\001\
-\005\001\006\001\007\001\008\001\009\001\010\001\011\001\255\255\
-\013\001\014\001\007\001\008\001\009\001\010\001\011\001\020\001\
-\255\255\255\255\255\255\016\001\255\255\255\255\255\255\020\001\
-\021\001\007\001\008\001\009\001\010\001\011\001\255\255\255\255\
-\255\255\255\255\016\001\255\255\255\255\255\255\020\001\021\001\
-\007\001\008\001\009\001\010\001\011\001\255\255\255\255\255\255\
-\255\255\016\001\255\255\255\255\255\255\020\001\021\001\007\001\
-\008\001\009\001\010\001\011\001\255\255\255\255\255\255\255\255\
-\016\001\255\255\255\255\255\255\020\001\021\001\007\001\008\001\
-\009\001\010\001\011\001\255\255\255\255\255\255\255\255\016\001\
-\255\255\255\255\255\255\020\001\021\001\003\001\004\001\005\001\
-\006\001\007\001\008\001\009\001\010\001\011\001\255\255\013\001\
-\014\001\255\255\016\001\003\001\004\001\005\001\006\001\007\001\
-\008\001\009\001\010\001\011\001\255\255\013\001\014\001\255\255\
-\016\001\003\001\004\001\005\001\006\001\007\001\008\001\009\001\
-\010\001\011\001\255\255\013\001\014\001\255\255\016\001"
-
-let yynames_const = "\
-  ADD\000\
-  MUL\000\
-  DIV\000\
-  MIN\000\
-  LT\000\
-  GT\000\
-  LEQ\000\
-  GEQ\000\
-  CMPEQ\000\
-  NOT\000\
-  AND\000\
-  OR\000\
-  LPAREN\000\
-  RPAREN\000\
-  RB\000\
-  LB\000\
-  EQ\000\
-  SC\000\
-  COM\000\
-  MAIN\000\
-  IF\000\
-  WHILE\000\
-  ELSE\000\
-  RETURN\000\
-  VARS\000\
-  EOF\000\
-  "
-
-let yynames_block = "\
-  VAR\000\
-  INT\000\
-  "
-
-let yyact = [|
-  (fun _ -> failwith "parser")
-; (fun __caml_parser_env ->
-    let _1 = (Parsing.peek_val __caml_parser_env 2 : 'fdecls) in
-    let _2 = (Parsing.peek_val __caml_parser_env 1 : 'main) in
-    Obj.repr(
-# 15 "parser.mly"
-                               ( {Ast.func = _1; Ast.main = _2} )
-# 283 "parser.ml"
-               : Ast.prg))
-; (fun __caml_parser_env ->
-    let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in
-    Obj.repr(
-# 18 "parser.mly"
-                        ( Ast.Var _1 )
-# 290 "parser.ml"
-               : 'expr))
-; (fun __caml_parser_env ->
-    let _1 = (Parsing.peek_val __caml_parser_env 0 : int) in
-    Obj.repr(
-# 19 "parser.mly"
-                        ( Ast.Int _1 )
-# 297 "parser.ml"
-               : 'expr))
-; (fun __caml_parser_env ->
-    let _1 = (Parsing.peek_val __caml_parser_env 2 : 'expr) in
-    let _3 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in
-    Obj.repr(
-# 20 "parser.mly"
-                        ( Ast.BinOp(_1,"+",_3) )
-# 305 "parser.ml"
-               : 'expr))
-; (fun __caml_parser_env ->
-    let _1 = (Parsing.peek_val __caml_parser_env 2 : 'expr) in
-    let _3 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in
-    Obj.repr(
-# 21 "parser.mly"
-                        ( Ast.BinOp(_1,"*",_3) )
-# 313 "parser.ml"
-               : 'expr))
-; (fun __caml_parser_env ->
-    let _1 = (Parsing.peek_val __caml_parser_env 2 : 'expr) in
-    let _3 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in
-    Obj.repr(
-# 22 "parser.mly"
-                        ( Ast.BinOp(_1,"-",_3) )
-# 321 "parser.ml"
-               : 'expr))
-; (fun __caml_parser_env ->
-    let _1 = (Parsing.peek_val __caml_parser_env 2 : 'expr) in
-    let _3 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in
-    Obj.repr(
-# 23 "parser.mly"
-                        ( Ast.BinOp(_1,"/",_3) )
-# 329 "parser.ml"
-               : 'expr))
-; (fun __caml_parser_env ->
-    let _1 = (Parsing.peek_val __caml_parser_env 2 : 'expr) in
-    let _3 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in
-    Obj.repr(
-# 24 "parser.mly"
-                        ( Ast.BinOp(_1,"<",_3) )
-# 337 "parser.ml"
-               : 'expr))
-; (fun __caml_parser_env ->
-    let _1 = (Parsing.peek_val __caml_parser_env 2 : 'expr) in
-    let _3 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in
-    Obj.repr(
-# 25 "parser.mly"
-                        ( Ast.BinOp(_1,">",_3) )
-# 345 "parser.ml"
-               : 'expr))
-; (fun __caml_parser_env ->
-    let _1 = (Parsing.peek_val __caml_parser_env 2 : 'expr) in
-    let _3 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in
-    Obj.repr(
-# 26 "parser.mly"
-                        ( Ast.BinOp(_1,"<=",_3) )
-# 353 "parser.ml"
-               : 'expr))
-; (fun __caml_parser_env ->
-    let _1 = (Parsing.peek_val __caml_parser_env 2 : 'expr) in
-    let _3 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in
-    Obj.repr(
-# 27 "parser.mly"
-                        ( Ast.BinOp(_1,">=",_3) )
-# 361 "parser.ml"
-               : 'expr))
-; (fun __caml_parser_env ->
-    let _1 = (Parsing.peek_val __caml_parser_env 2 : 'expr) in
-    let _3 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in
-    Obj.repr(
-# 28 "parser.mly"
-                        ( Ast.BinOp(_1,"==",_3) )
-# 369 "parser.ml"
-               : 'expr))
-; (fun __caml_parser_env ->
-    let _1 = (Parsing.peek_val __caml_parser_env 2 : 'expr) in
-    let _3 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in
-    Obj.repr(
-# 29 "parser.mly"
-                        ( Ast.BinOp(_1,"&&",_3) )
-# 377 "parser.ml"
-               : 'expr))
-; (fun __caml_parser_env ->
-    let _1 = (Parsing.peek_val __caml_parser_env 2 : 'expr) in
-    let _3 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in
-    Obj.repr(
-# 30 "parser.mly"
-                        ( Ast.BinOp(_1,"||",_3) )
-# 385 "parser.ml"
-               : 'expr))
-; (fun __caml_parser_env ->
-    let _2 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in
-    Obj.repr(
-# 31 "parser.mly"
-                        ( Ast.UniOp("-",_2) )
-# 392 "parser.ml"
-               : 'expr))
-; (fun __caml_parser_env ->
-    let _2 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in
-    Obj.repr(
-# 32 "parser.mly"
-                        ( Ast.UniOp("!",_2) )
-# 399 "parser.ml"
-               : 'expr))
-; (fun __caml_parser_env ->
-    let _1 = (Parsing.peek_val __caml_parser_env 1 : string) in
-    let _2 = (Parsing.peek_val __caml_parser_env 0 : 'params) in
-    Obj.repr(
-# 34 "parser.mly"
-      ( Ast.Call (_1,_2) )
-# 407 "parser.ml"
-               : 'expr))
-; (fun __caml_parser_env ->
-    let _2 = (Parsing.peek_val __caml_parser_env 1 : 'expr) in
-    Obj.repr(
-# 35 "parser.mly"
-                        ( _2 )
-# 414 "parser.ml"
-               : 'expr))
-; (fun __caml_parser_env ->
-    Obj.repr(
-# 39 "parser.mly"
-                        ( [] )
-# 420 "parser.ml"
-               : 'params))
-; (fun __caml_parser_env ->
-    let _2 = (Parsing.peek_val __caml_parser_env 1 : 'elist) in
-    Obj.repr(
-# 40 "parser.mly"
-                        ( _2 )
-# 427 "parser.ml"
-               : 'params))
-; (fun __caml_parser_env ->
-    let _1 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in
-    Obj.repr(
-# 44 "parser.mly"
-                        ( _1::[] )
-# 434 "parser.ml"
-               : 'elist))
-; (fun __caml_parser_env ->
-    let _1 = (Parsing.peek_val __caml_parser_env 2 : 'expr) in
-    let _3 = (Parsing.peek_val __caml_parser_env 0 : 'elist) in
-    Obj.repr(
-# 45 "parser.mly"
-                        ( _1::_3 )
-# 442 "parser.ml"
-               : 'elist))
-; (fun __caml_parser_env ->
-    let _1 = (Parsing.peek_val __caml_parser_env 3 : string) in
-    let _3 = (Parsing.peek_val __caml_parser_env 1 : 'expr) in
-    Obj.repr(
-# 49 "parser.mly"
-                        ( Ast.Assign (_1,_3) )
-# 450 "parser.ml"
-               : 'stm))
-; (fun __caml_parser_env ->
-    let _1 = (Parsing.peek_val __caml_parser_env 1 : 'expr) in
-    Obj.repr(
-# 50 "parser.mly"
-                        ( Ast.Expr _1 )
-# 457 "parser.ml"
-               : 'stm))
-; (fun __caml_parser_env ->
-    let _3 = (Parsing.peek_val __caml_parser_env 2 : 'expr) in
-    let _5 = (Parsing.peek_val __caml_parser_env 0 : 'stmblock) in
-    Obj.repr(
-# 52 "parser.mly"
-      ( Ast.If (_3, _5, []) )
-# 465 "parser.ml"
-               : 'stm))
-; (fun __caml_parser_env ->
-    let _3 = (Parsing.peek_val __caml_parser_env 4 : 'expr) in
-    let _5 = (Parsing.peek_val __caml_parser_env 2 : 'stmblock) in
-    let _7 = (Parsing.peek_val __caml_parser_env 0 : 'stmblock) in
-    Obj.repr(
-# 54 "parser.mly"
-      ( Ast.If (_3, _5, _7) )
-# 474 "parser.ml"
-               : 'stm))
-; (fun __caml_parser_env ->
-    let _3 = (Parsing.peek_val __caml_parser_env 2 : 'expr) in
-    let _5 = (Parsing.peek_val __caml_parser_env 0 : 'stmblock) in
-    Obj.repr(
-# 56 "parser.mly"
-      ( Ast.While (_3, _5) )
-# 482 "parser.ml"
-               : 'stm))
-; (fun __caml_parser_env ->
-    let _2 = (Parsing.peek_val __caml_parser_env 1 : 'expr) in
-    Obj.repr(
-# 57 "parser.mly"
-                        ( Ast.Return _2 )
-# 489 "parser.ml"
-               : 'stm))
-; (fun __caml_parser_env ->
-    Obj.repr(
-# 60 "parser.mly"
-                        ( [] )
-# 495 "parser.ml"
-               : 'stmblock))
-; (fun __caml_parser_env ->
-    let _2 = (Parsing.peek_val __caml_parser_env 1 : 'stmlist) in
-    Obj.repr(
-# 61 "parser.mly"
-                        ( _2 )
-# 502 "parser.ml"
-               : 'stmblock))
-; (fun __caml_parser_env ->
-    let _1 = (Parsing.peek_val __caml_parser_env 0 : 'stm) in
-    Obj.repr(
-# 65 "parser.mly"
-                        ( _1::[] )
-# 509 "parser.ml"
-               : 'stmlist))
-; (fun __caml_parser_env ->
-    let _1 = (Parsing.peek_val __caml_parser_env 1 : 'stm) in
-    let _2 = (Parsing.peek_val __caml_parser_env 0 : 'stmlist) in
-    Obj.repr(
-# 66 "parser.mly"
-                        ( _1::_2 )
-# 517 "parser.ml"
-               : 'stmlist))
-; (fun __caml_parser_env ->
-    let _2 = (Parsing.peek_val __caml_parser_env 1 : 'vlist) in
-    Obj.repr(
-# 70 "parser.mly"
-                        ( _2 )
-# 524 "parser.ml"
-               : 'vars))
-; (fun __caml_parser_env ->
-    let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in
-    Obj.repr(
-# 74 "parser.mly"
-                        ( _1::[] )
-# 531 "parser.ml"
-               : 'vlist))
-; (fun __caml_parser_env ->
-    let _1 = (Parsing.peek_val __caml_parser_env 2 : string) in
-    let _3 = (Parsing.peek_val __caml_parser_env 0 : 'vlist) in
-    Obj.repr(
-# 75 "parser.mly"
-                        ( _1::_3 )
-# 539 "parser.ml"
-               : 'vlist))
-; (fun __caml_parser_env ->
-    Obj.repr(
-# 79 "parser.mly"
-                        ( [] )
-# 545 "parser.ml"
-               : 'fparam))
-; (fun __caml_parser_env ->
-    let _2 = (Parsing.peek_val __caml_parser_env 1 : 'vlist) in
-    Obj.repr(
-# 80 "parser.mly"
-                        ( _2 )
-# 552 "parser.ml"
-               : 'fparam))
-; (fun __caml_parser_env ->
-    Obj.repr(
-# 84 "parser.mly"
-                        ( ([],[]) )
-# 558 "parser.ml"
-               : 'body))
-; (fun __caml_parser_env ->
-    let _2 = (Parsing.peek_val __caml_parser_env 1 : 'stmlist) in
-    Obj.repr(
-# 85 "parser.mly"
-                        ( ([],_2) )
-# 565 "parser.ml"
-               : 'body))
-; (fun __caml_parser_env ->
-    let _2 = (Parsing.peek_val __caml_parser_env 2 : 'vars) in
-    let _3 = (Parsing.peek_val __caml_parser_env 1 : 'stmlist) in
-    Obj.repr(
-# 86 "parser.mly"
-                        ( (_2,_3) )
-# 573 "parser.ml"
-               : 'body))
-; (fun __caml_parser_env ->
-    let _1 = (Parsing.peek_val __caml_parser_env 2 : string) in
-    let _2 = (Parsing.peek_val __caml_parser_env 1 : 'fparam) in
-    let _3 = (Parsing.peek_val __caml_parser_env 0 : 'body) in
-    Obj.repr(
-# 90 "parser.mly"
-      (
-        let (v,b) = _3 in
-        {
-          Ast.fname   = _1;
-          Ast.fparams = _2;
-          Ast.fvars   = v;
-          Ast.fbody   = b;
-        }
-      )
-# 590 "parser.ml"
-               : 'fdecl))
-; (fun __caml_parser_env ->
-    Obj.repr(
-# 102 "parser.mly"
-                        ( [] )
-# 596 "parser.ml"
-               : 'fdecls))
-; (fun __caml_parser_env ->
-    let _1 = (Parsing.peek_val __caml_parser_env 1 : 'fdecl) in
-    let _2 = (Parsing.peek_val __caml_parser_env 0 : 'fdecls) in
-    Obj.repr(
-# 103 "parser.mly"
-                        ( _1::_2 )
-# 604 "parser.ml"
-               : 'fdecls))
-; (fun __caml_parser_env ->
-    let _4 = (Parsing.peek_val __caml_parser_env 0 : 'body) in
-    Obj.repr(
-# 108 "parser.mly"
-      (
-        let (v,b) = _4 in
-        {
-          Ast.mainvars = v;
-          Ast.mainbody = b;
-        }
-      )
-# 617 "parser.ml"
-               : 'main))
-(* Entry prg *)
-; (fun __caml_parser_env -> raise (Parsing.YYexit (Parsing.peek_val __caml_parser_env 0)))
-|]
-let yytables =
-  { Parsing.actions=yyact;
-    Parsing.transl_const=yytransl_const;
-    Parsing.transl_block=yytransl_block;
-    Parsing.lhs=yylhs;
-    Parsing.len=yylen;
-    Parsing.defred=yydefred;
-    Parsing.dgoto=yydgoto;
-    Parsing.sindex=yysindex;
-    Parsing.rindex=yyrindex;
-    Parsing.gindex=yygindex;
-    Parsing.tablesize=yytablesize;
-    Parsing.table=yytable;
-    Parsing.check=yycheck;
-    Parsing.error_function=parse_error;
-    Parsing.names_const=yynames_const;
-    Parsing.names_block=yynames_block }
-let prg (lexfun : Lexing.lexbuf -> token) (lexbuf : Lexing.lexbuf) =
-   (Parsing.yyparse yytables 1 lexfun lexbuf : Ast.prg)

MiniProj/_build/parser.ml.depends

-parser.ml: Ast Lexing Obj Parsing

MiniProj/_build/parser.mli

-type token =
-  | VAR of (string)
-  | INT of (int)
-  | ADD
-  | MUL
-  | DIV
-  | MIN
-  | LT
-  | GT
-  | LEQ
-  | GEQ
-  | CMPEQ
-  | NOT
-  | AND
-  | OR
-  | LPAREN
-  | RPAREN
-  | RB
-  | LB
-  | EQ
-  | SC
-  | COM
-  | MAIN
-  | IF
-  | WHILE
-  | ELSE
-  | RETURN
-  | VARS
-  | EOF
-
-val prg :
-  (Lexing.lexbuf  -> token) -> Lexing.lexbuf -> Ast.prg

MiniProj/_build/parser.mli.depends

-parser.mli: Ast Lexing

MiniProj/_build/parser.mly

-%token <string> VAR
-%token <int> INT
-%token ADD MUL DIV MIN LT GT LEQ GEQ CMPEQ NOT AND OR
-%token LPAREN RPAREN RB LB EQ SC COM
-%token MAIN IF WHILE ELSE RETURN VARS
-%token EOF
-%left LT GT LEQ GEQ CMPEQ
-%left ADD MIN AND OR
-%left MUL DIV
-%nonassoc UMIN NOT
-%start prg
-%type <Ast.prg> prg
-%%
-prg:
-fdecls main EOF                { {Ast.func = $1; Ast.main = $2} };
-
-expr:
-  VAR                   { Ast.Var $1 }
-  | INT                 { Ast.Int $1 }
-  | expr ADD expr       { Ast.BinOp($1,"+",$3) }
-  | expr MUL expr       { Ast.BinOp($1,"*",$3) }
-  | expr MIN expr       { Ast.BinOp($1,"-",$3) }
-  | expr DIV expr       { Ast.BinOp($1,"/",$3) }
-  | expr LT expr        { Ast.BinOp($1,"<",$3) }
-  | expr GT expr        { Ast.BinOp($1,">",$3) }
-  | expr LEQ expr       { Ast.BinOp($1,"<=",$3) }
-  | expr GEQ expr       { Ast.BinOp($1,">=",$3) }
-  | expr CMPEQ expr     { Ast.BinOp($1,"==",$3) }
-  | expr AND expr       { Ast.BinOp($1,"&&",$3) }
-  | expr OR expr        { Ast.BinOp($1,"||",$3) }
-  | MIN expr %prec UMIN { Ast.UniOp("-",$2) }
-  | NOT expr            { Ast.UniOp("!",$2) }
-  | VAR params
-      { Ast.Call ($1,$2) }
-  | LPAREN expr RPAREN  { $2 }
-;
-
-params:
-  | LPAREN RPAREN       { [] }
-  | LPAREN elist RPAREN { $2 }
-;
-
-elist:
-  | expr                { $1::[] }
-  | expr COM elist      { $1::$3 }
-;
-
-stm:
-  | VAR EQ expr SC      { Ast.Assign ($1,$3) }
-  | expr SC             { Ast.Expr $1 }
-  | IF LPAREN expr RPAREN stmblock
-      { Ast.If ($3, $5, []) }
-  | IF LPAREN expr RPAREN stmblock ELSE stmblock
-      { Ast.If ($3, $5, $7) }
-  | WHILE LPAREN expr RPAREN stmblock
-      { Ast.While ($3, $5) }
-  | RETURN expr SC      { Ast.Return $2 }
-
-stmblock:
-  | LB RB               { [] }
-  | LB stmlist RB       { $2 }
-;
-
-stmlist:
-  | stm                 { $1::[] }
-  | stm stmlist         { $1::$2 }
-;
-
-vars:
-  | VARS vlist SC       { $2 }
-;
-
-vlist:
-  | VAR                 { $1::[] }
-  | VAR COM vlist       { $1::$3 }
-;
-
-fparam:
-  | LPAREN RPAREN       { [] }
-  | LPAREN vlist RPAREN { $2 }
-;
-
-body:
-  | LB RB               { ([],[]) }
-  | LB stmlist RB       { ([],$2) }
-  | LB vars stmlist RB  { ($2,$3) }
-
-fdecl:
-  | VAR fparam body
-      {
-        let (v,b) = $3 in
-        {
-          Ast.fname   = $1;
-          Ast.fparams = $2;
-          Ast.fvars   = v;
-          Ast.fbody   = b;
-        }
-      }
-;
-
-fdecls:
-  |                     { [] }
-  | fdecl fdecls        { $1::$2 }
-;
-
-main:
-  | MAIN LPAREN RPAREN body
-      {
-        let (v,b) = $4 in
-        {
-          Ast.mainvars = v;
-          Ast.mainbody = b;
-        }
-      }
-;
Add a comment to this file

MiniProj/_build/parser.o

Binary file removed.

Add a comment to this file

MiniProj/blaise

Binary file removed.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.