Yu Nejigane > Language-MinCaml-0.01 > Language::MinCaml

Download:
Language-MinCaml-0.01.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.01   Source  

NAME ^

Language::MinCaml - MinCaml Interpreter

SYNOPSIS ^

  use Language::MinCaml;

  # interpret a string
  Language::MinCaml->interpret_string(<<EOC);
  let rec gcd m n =
    if m = 0 then n else
    if m <= n then gcd m (n - m) else
    gcd n (m - n) in
  print_int (gcd 100 125)
  EOC

  # or, interpret a source file
  Language::MinCaml->interpret_file('/path/to/source.ml');

DESCRIPTION ^

Language::MinCaml is an interpreter of MinCaml which is a subset of programming language ML.

MinCaml was originally defined by Eijiro Sumii, and he implemented the MinCaml compiler with OCaml for educational purposes.

FUNCTIONS

interpret_string($string)

Interpret a string representing a MinCaml code.

interpret_file($file_path)

Interpret a MinCaml code in a file pointed to by $file_path.

TODO ^

Support skipping comment lines '(* .. *)'.

Support other built-in functions (Now only print_int and print_float).

Improve error messages.

AUTHOR ^

Yu Nejigane <nejigane@cpan.org>

LICENSE ^

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO ^

This module is dependent on Parse::Yapp module for parsing. Parse::Yapp

http://min-caml.sourceforge.net/index-e.html

syntax highlighting: