Skip to content
Snippets Groups Projects
Commit c5312543 authored by Augustin Jaujay's avatar Augustin Jaujay
Browse files

Question 7

parent 91378a00
Branches
Tags
No related merge requests found
......@@ -2,6 +2,7 @@
{
(* open Parser
open Ast *)
open Utils
type token =
| EOF | PUSH | POP | SWAP | ADD | SUB | MUL | DIV | REM | INT of int
......@@ -49,7 +50,7 @@ rule token = parse
| "div" {DIV}
| "rem" {REM}
(* illegal characters *)
| _ as c { failwith (Printf.sprintf "Illegal character '%c': " c) }
| _ { failwith (Location.string_of (Location.curr lexbuf)) }
{
let rec examine_all lexbuf =
......@@ -65,6 +66,7 @@ rule token = parse
try
let input_file = open_in file in
let lexbuf = Lexing.from_channel input_file in
Location.init lexbuf file;
examine_all lexbuf;
print_newline ();
close_in (input_file)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment