Skip to content
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

test pr #48

Open
wants to merge 7 commits into
base: lexer
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Stefan Heller

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions lang/compile.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@
['- (Sub (assert-integer e1) (assert-integer e2))]
['* (runtime-int->bits (Mul (runtime-bits->int (assert-integer e1)) (runtime-bits->int(assert-integer e2))))]
['/ (runtime-int->bits (Div (runtime-bits->int (assert-integer e1)) (runtime-bits->int(assert-integer e2))))]
['% (Rem (assert-integer e1) (assert-integer e2))]
['or (Or e1 e2)]
['and (And e1 e2)]
['xor (Xor e1 e2)]
Expand Down
2 changes: 1 addition & 1 deletion lang/parse.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
box unbox empty? cons? box? car cdr
vector? vector-length string? string-length))
(define op2
'(+ - < = * / << >> and or xor cons eq? make-vector vector-ref make-string string-ref))
'(+ - < = * / << >> % and or xor cons eq? make-vector vector-ref make-string string-ref))
(define op3
'(vector-set!))

Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"homepage": "https://github.com/stefanhts/430_finalproj#readme",
"dependencies": {
"express": "^4.17.3",
"node-fetch": "^3.2.3"
"node-fetch": "^3.2.10"
},
"module": "true"
}
2 changes: 2 additions & 0 deletions tests/arithmetic/1.wkt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#lang wacket
(% 10 3)
2 changes: 2 additions & 0 deletions wat/ast.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
;; Convenience for adding 64 bit integers.
(struct Sub (i1 i2) #:prefab)

(struct Rem (i1 i2) #:prefab)

(struct Mul (i1 i2) #:prefab)

(struct Div (i1 i2) #:prefab)
Expand Down
1 change: 1 addition & 0 deletions wat/printer.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@
[(Sub i1 i2) (list "i64.sub" (seq i1 i2))]
[(Mul i1 i2) (list "i64.mul" (seq i1 i2))]
[(Div i1 i2) (list "i64.div_s" (seq i1 i2))]
[(Rem i1 i2) (list "i64.rem_s" (seq i1 i2))]
[(And i1 i2) (list "i64.and" (seq i1 i2))]
[(Or i1 i2) (list "i64.or" (seq i1 i2))]
[(Xor i1 i2) (list "i64.xor" (seq i1 i2))]
Expand Down