No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
nand-pl
python
NAND.ipynb
README.md
Untitled0.ipynb

README.md

NAND* Programming languages

Ocaml implementation of the NAND, NAND++ and NAND<< programming languages from http://www.introtcs.org. See in particular the following appendix for the languages' specifications.

See this website for a web interface of this implementation.

To compile on OS X and Linux:

  • Clone the repository-- we recommend you pull frequently, so that you can have the latest version.
  • Once in the root directory of the repository, enter the NAND source with the command cd nand-pl
  • Then run the script build.bash with the command ./build.bash
  • If the compilation is successful, it will produce the executable main.native
  • For your convenience, we recommend adding an alias to your .bashrc or .bash_profile by adding alias nand=<absolute path to main.native>. That way, you don't have to perform all of your development in the same directory in the build. The rest of the README assumes you have this alias; if you don't, then ./main.native will substitute for nand

To run your .nand programs:

  • All NAND* programs must have a filename that ends with .nand
  • To run a program, type nand [flags] <path/to/prog.nand> <binary input>
  • The program will run, printing its trace and eventual output to stdout
  • The recognized flags are as follows:
    • -pp, -ll: run the NAND++ and NAND<< interpreters, respectively. NAND is the default.
    • -addSS: enables syntactic sugar for the program.
    • -s: silences the execution trace.
    • -dry: outputs the source of the program that would have been executed to stdout.

Dependencies

In order to compile this code, you will need OCaml, ocamlbuild, ocamllex, and ocamlyacc installed on your computer. Installation instructions can be found on the following website: https://ocaml.org/docs/install.html. The build.bash script for OS X and Linux checks for the presence of these program, and will abort the build if they are not present.