Giter Site home page Giter Site logo

nand2tetris.el's Introduction

nand2tetris.el

http://melpa.org/packages/nand2tetris-badge.svg

The aim of this package is to be best emacs tool to accompany you on your nand2tetris journey in Coursera, or the Official Website for it.

Only works on Linux/OSX...for now

Getting Started

Set the path to your nand2tetris directory with e.g. (setq nand2tetris-core-base-dir "~/nand2tetris").

Goodies

Using C-c C-c will call nand2tetris/tests-current-hdl-elsewhere which is the same as running:

HardwareSimulator.sh FILE.tst    Starts the Hardware Simulator and runs the
                                 FILE.tst test script.  The success/failure
                                 message is printed to the command console.

And printing the result in the modeline, it looks like this:

img/test-current-hdl.png

Contributors

  • @davidshepherd7

nand2tetris.el's People

Contributors

cestdiego avatar davidshepherd7 avatar syohex avatar xiongtx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nand2tetris.el's Issues

void-variable nand2tetris-core-base-dir

Hi,
after intalling this quite interesting package via package-manager, Emacs starts with the following error:

Debugger entered--Lisp error: (void-variable nand2tetris-core-base-dir)
(expand-file-name nand2tetris-core-base-dir)
(concat (expand-file-name nand2tetris-core-base-dir) ".\.hdl")
(cons (concat (expand-file-name nand2tetris-core-base-dir) ".
\.hdl") (quote (quote nand2tetris-mode)))
(add-to-list (quote auto-mode-alist) (cons (concat (expand-file-name nand2tetris-core-base-dir) ".*\.hdl") (quote (quote nand2tetris-mode))))
eval-buffer(#<buffer load-175805> nil "/home/MyName/.emacs.d/elpa/nand2tetris-20170306.1827/nand2tetris-autoloads.el" nil t) ; Reading at buffer position 957
load-with-code-conversion("/home/MyName/.emacs.d/elpa/nand2tetris-20170306.1827/nand2tetris-autoloads.el" "/home/MyName/.emacs.d/elpa/nand2tetris-20170306.1827/nand2tetris-autoloads.el" nil t)
load("/home/MyName/.emacs.d/elpa/nand2tetris-20170306.1827/nand2tetris-autoloads" nil t)
package--activate-autoloads-and-load-path([cl-struct-package-desc nand2tetris (20170306 1827) "Major mode for HDL files in the nand2tetris course" ((emacs (24))) nil nil "/home/MyName/.emacs.d/elpa/nand2tetris-20170306.1827" ((:keywords "nand2tetris" "hdl") (:url . "http://www.github.com/CestDiego/nand2tetris.el/")) nil])
package--load-files-for-activation([cl-struct-package-desc nand2tetris (20170306 1827) "Major mode for HDL files in the nand2tetris course" ((emacs (24))) nil nil "/home/MyName/.emacs.d/elpa/nand2tetris-20170306.1827" ((:keywords "nand2tetris" "hdl") (:url . "http://www.github.com/CestDiego/nand2tetris.el/")) nil] nil)
package-activate-1([cl-struct-package-desc nand2tetris (20170306 1827) "Major mode for HDL files in the nand2tetris course" ((emacs (24))) nil nil "/home/MyName/.emacs.d/elpa/nand2tetris-20170306.1827" ((:keywords "nand2tetris" "hdl") (:url . "http://www.github.com/CestDiego/nand2tetris.el/")) nil] nil deps)
package-activate(nand2tetris)
package-initialize()
eval-buffer(#<buffer load-39633> nil "/home/MyName/.gnu-emacs25" nil t) ; Reading at buffer position 723
load-with-code-conversion("/home/MyName/.gnu-emacs25" "/home/MyName/.gnu-emacs25" nil nil)
load("/home/MyName/.gnu-emacs25")
(cond ((string-match "^23" emacs-version) (load (expand-file-name "/.gnu-emacs23-all-cvs")) (setq custom-file (expand-file-name "/.gnu-emacs23-cvs-custom"))) ((string-match "^24" emacs-version) (load (expand-file-name "/.gnu-emacs24")) (setq custom-file (expand-file-name "/.gnu-emacs24-custom"))) ((string-match "^25" emacs-version) (load (expand-file-name "/.gnu-emacs25")) (setq custom-file (expand-file-name "/.gnu-emacs25-custom"))))
eval-buffer(#<buffer load> nil "/home/MyName/.emacs" nil t) ; Reading at buffer position 866
load-with-code-conversion("/home/MyName/.emacs" "/home/MyName/.emacs" t t)
load("~/.emacs" t t)
#[0 "๏ฟฝ\205\266

Wrong format for entry in auto-mode-alist

Hello. Thanks for this useful software.

I wasn't able to get it running automatically when I opened project-files. I was getting a "File mode specification error". It worked fine when enabled automatically.

I think this was due to a faulty entry in auto-mode-alist. The relevant code can be found at the end of nand2tetris.el:

(add-to-list 'auto-mode-alist
             `(,(concat (expand-file-name nand2tetris-core-base-dir) "\.*\\.hdl")
               . 'nand2tetris-mode))

This was resulting in an entry to auto-mode-alist which was dissimilar to the other entries; deleting the quote before the mode in the above expression produced a properly-formatted entry in auto-mode-alist and resolved the problem for me. The revised code is below:

(add-to-list 'auto-mode-alist
             `(,(concat (expand-file-name nand2tetris-core-base-dir) "\.*\\.hdl")
               . nand2tetris-mode))

tests-current-hdl-elsewhere uses hdl files that the function was previously run on

Every time this function runs it copies the target files to /tmp and runs the hardware simulator there. But this means that any files that were previously copied there are still hanging around for future test runs. So the hardware simulator tries to use them instead of the builtin chips.

A simple fix would be to generate a new temp directory each time with (make-temp-file "nand2tetris" t). As a side benefit this would also be more portable: /tmp isn't always the correct temp directory.

It's not really bothering me (I think I'll use tests-current-hdl anyway from now on so that I can see the outputs), but I thought you would like to know.

Thanks for the nice package ๐Ÿ‘.

Avoid using namespace libraries

First, thanks for creating this package--it makes working with the Nand2Tetris course much easier!

I would suggest, however, that namespace libraries like names be avoided. While they may seem convenient, there are some annoying quirks. For example, if I eval-defun on a variable like -assembler, I am actually putting a new value into -assembler, not nand2tetris-assembler.

Also, using customizable variables for directories means that changing the base directory nand2tetris-core-base-dir does not propagate the change to all relevant values and functions. There's really no need for these variables; the script functions should just use nand2tetris-core-base-dir directly.

Auto-indent for parenthesis

It would be nice if the mode would automatically indent multi-line function arguments to the appropriate parenthesis. For example, when I tab-indent the second line in this example I currently get this:

Mux16(a=XWithY, b=InvertedXWithY, sel=no,
out[0..7]=OutLow, out[8..15]=OutHigh, out[15]=ng, out=out);

But I expected to get this:

Mux16(a=XWithY, b=InvertedXWithY, sel=no,
      out[0..7]=OutLow, out[8..15]=OutHigh, out[15]=ng, out=out);

I've done a little bit of this in the past, and I might be able to put some time into this at some point. But I at least wanted to get this onto the issue tracker.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.