-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Added HDL (Hardware Description Language) support #1710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
ceb190c
fba47c1
ddfe7c2
d78e87f
066757f
a2e8c5e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| Prism.languages['nand2tetris-hdl'] = { | ||
| 'comment': /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/, | ||
| 'keyword': /\b(?:CHIP|IN|OUT|PARTS|BUILTIN|CLOCKED)\b/, | ||
| 'boolean': /\b(?:true|false)\b/, | ||
| 'number': /\b\d+\b/, | ||
| 'operator': /=|\.\./, | ||
| 'punctuation': /[{}[\];(),:]/ | ||
| }; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <h2>Comments</h2> | ||
| <pre><code>// Single line comment | ||
| /* Multi-line | ||
| comment */</code></pre> | ||
|
|
||
| <h2>Literal values</h2> | ||
| <pre><code>0 | ||
| 32 | ||
| true | ||
| false</code></pre> | ||
|
|
||
| <h2>Full example</h2> | ||
| <pre><code>/* | ||
| * Checks if two input bits are equal | ||
| */ | ||
|
|
||
| CHIP Eq { | ||
| IN a, b; | ||
| OUT out; // True iff a=b | ||
RunDevelopment marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| PARTS: | ||
| Xor(a=a, b=b, out=uneq); | ||
| Not(in=uneq, out=out); | ||
| }</code></pre> | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| true | ||
| false | ||
|
|
||
| ---------------------------------------------------- | ||
|
|
||
| [ | ||
| ["boolean", "true"], | ||
| ["boolean", "false"] | ||
| ] | ||
|
|
||
| ---------------------------------------------------- | ||
|
|
||
| Checks for booleans. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| // foobar | ||
| /**/ | ||
| /* foo | ||
| bar */ | ||
| /* | ||
| * foobar | ||
| */ | ||
|
|
||
| ---------------------------------------------------- | ||
|
|
||
| [ | ||
| ["comment", "// foobar"], | ||
| ["comment", "/**/"], | ||
| ["comment", "/* foo\r\nbar */"], | ||
| ["comment", "/*\r\n * foobar\r\n */"] | ||
| ] | ||
|
|
||
| ---------------------------------------------------- | ||
|
|
||
| Checks for single-line and multi-line comments. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| CHIP | ||
| IN | ||
| OUT | ||
| PARTS | ||
| BUILTIN | ||
| CLOCKED | ||
|
|
||
| ---------------------------------------------------- | ||
|
|
||
| [ | ||
| ["keyword", "CHIP"], | ||
| ["keyword", "IN"], | ||
| ["keyword", "OUT"], | ||
| ["keyword", "PARTS"], | ||
| ["keyword", "BUILTIN"], | ||
| ["keyword", "CLOCKED"] | ||
| ] | ||
|
|
||
| ---------------------------------------------------- | ||
|
|
||
| Checks for all keywords. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| 0 | ||
| 16 | ||
| 32 | ||
|
|
||
| ---------------------------------------------------- | ||
|
|
||
| [ | ||
| ["number", "0"], | ||
| ["number", "16"], | ||
| ["number", "32"] | ||
| ] | ||
|
|
||
| ---------------------------------------------------- | ||
|
|
||
| Checks for integer numbers. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| = | ||
| .. | ||
|
|
||
| ---------------------------------------------------- | ||
|
|
||
| [ | ||
| ["operator", "="], | ||
| ["operator", ".."] | ||
| ] | ||
|
|
||
| ---------------------------------------------------- | ||
|
|
||
| Checks for all operators. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| ( ) | ||
| { } | ||
| [ ] | ||
| , | ||
| ; | ||
| : | ||
|
|
||
| ---------------------------------------------------- | ||
|
|
||
| [ | ||
| ["punctuation", "("], | ||
| ["punctuation", ")"], | ||
| ["punctuation", "{"], | ||
| ["punctuation", "}"], | ||
| ["punctuation", "["], | ||
| ["punctuation", "]"], | ||
| ["punctuation", ","], | ||
| ["punctuation", ";"], | ||
| ["punctuation", ":"] | ||
| ] | ||
| ---------------------------------------------------- | ||
|
|
||
| Checks for punctuation. |
Uh oh!
There was an error while loading. Please reload this page.