temp commit 1; needs to be merged
This commit is contained in:
parent
7c4e3738ee
commit
49e2df75ca
@ -1,5 +1,5 @@
|
|||||||
function main() {
|
function main() {
|
||||||
let socket = new WebSocket("ws://localhost:8765");
|
let socket = new WebSocket("ws://localhost:8764");
|
||||||
var ids = [];
|
var ids = [];
|
||||||
|
|
||||||
socket.onopen = function(e) {
|
socket.onopen = function(e) {
|
||||||
@ -43,4 +43,4 @@ function main() {
|
|||||||
console.log(`[LOG] couldn't parse message ${e.data}`)
|
console.log(`[LOG] couldn't parse message ${e.data}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} main();
|
} main();
|
||||||
|
@ -37,6 +37,8 @@ id testing : B = [1, 4, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
|||||||
: ibl(addr, b, c) = {less = 1 : ijmp(addr, 0, 0), jumped -> 1}
|
: ibl(addr, b, c) = {less = 1 : ijmp(addr, 0, 0), jumped -> 1}
|
||||||
|
|
||||||
: isto(v, addr) = setlistval(addr, v)
|
: isto(v, addr) = setlistval(addr, v)
|
||||||
|
: imov(from, target) = setlistval(target, B[from])
|
||||||
|
: ipsto(value, ptr) = setlistval(B[ptr], value)
|
||||||
|
|
||||||
# registers
|
# registers
|
||||||
# instruction pointer
|
# instruction pointer
|
||||||
@ -65,20 +67,22 @@ id testing : B = [1, 4, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
|||||||
paramtwo -> B[addr + 2], \
|
paramtwo -> B[addr + 2], \
|
||||||
paramthree -> B[addr + 3]
|
paramthree -> B[addr + 3]
|
||||||
: exec = { \
|
: exec = { \
|
||||||
inst = sto : isto(paramone, paramtwo), \
|
inst = sto : isto(paramone, paramtwo), \
|
||||||
inst = add : iadd(paramone, paramtwo, paramthree), \
|
inst = psto : ipsto(paramone, paramtwo), \
|
||||||
inst = cmp : icmp(paramone, paramtwo, paramthree), \
|
inst = mov : imov(paramone, paramtwo), \
|
||||||
inst = eld : ield(paramone, paramtwo), \
|
inst = add : iadd(paramone, paramtwo, paramthree), \
|
||||||
inst = gld : igld(paramone, paramtwo), \
|
inst = cmp : icmp(paramone, paramtwo, paramthree), \
|
||||||
inst = lld : illd(paramone, paramtwo), \
|
inst = eld : ield(paramone, paramtwo), \
|
||||||
inst = jmp : ijmp(paramone, paramtwo, paramthree), \
|
inst = gld : igld(paramone, paramtwo), \
|
||||||
inst = be : ibe(paramone, paramtwo, paramthree), \
|
inst = lld : illd(paramone, paramtwo), \
|
||||||
inst = bne : ibne(paramone, paramtwo, paramthree), \
|
inst = jmp : ijmp(paramone, paramtwo, paramthree), \
|
||||||
inst = bg : ibg(paramone, paramtwo, paramthree), \
|
inst = be : ibe(paramone, paramtwo, paramthree), \
|
||||||
inst = bl : ibl(paramone, paramtwo, paramthree), \
|
inst = bne : ibne(paramone, paramtwo, paramthree), \
|
||||||
inst = sub : isub(paramone, paramtwo, paramthree), \
|
inst = bg : ibg(paramone, paramtwo, paramthree), \
|
||||||
inst = mul : imul(paramone, paramtwo, paramthree), \
|
inst = bl : ibl(paramone, paramtwo, paramthree), \
|
||||||
inst = div : idiv(paramone, paramtwo, paramthree) \
|
inst = sub : isub(paramone, paramtwo, paramthree), \
|
||||||
|
inst = mul : imul(paramone, paramtwo, paramthree), \
|
||||||
|
inst = div : idiv(paramone, paramtwo, paramthree) \
|
||||||
}
|
}
|
||||||
: incip = {jumped = 0 : ip -> ip + instwidth[inst] + 1}
|
: incip = {jumped = 0 : ip -> ip + instwidth[inst] + 1}
|
||||||
|
|
||||||
@ -91,6 +95,8 @@ id testing : B = [1, 4, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
|||||||
: main = loopaction, loop
|
: main = loopaction, loop
|
||||||
|
|
||||||
: sto = 1
|
: sto = 1
|
||||||
|
: psto = 16
|
||||||
|
: mov = 17
|
||||||
: add = 2
|
: add = 2
|
||||||
: cmp = 3
|
: cmp = 3
|
||||||
: eld = 4
|
: eld = 4
|
||||||
@ -106,4 +112,4 @@ id testing : B = [1, 4, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
|||||||
: div = 14
|
: div = 14
|
||||||
: rst = 15
|
: rst = 15
|
||||||
|
|
||||||
: instwidth = [2,3,1,1,1,1,1,1,1,1,3,3,3,3,0]
|
: instwidth = [2,3,1,1,1,1,1,1,1,1,3,3,3,3,0,2,2]
|
||||||
|
@ -9,16 +9,21 @@ def get_overrides(file):
|
|||||||
fd.close()
|
fd.close()
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def entry():
|
def define_args(parser):
|
||||||
parser = argparse.ArgumentParser(
|
|
||||||
prog="desmos-sync",
|
|
||||||
description="Synchronize from local file to Desmos calculator",
|
|
||||||
)
|
|
||||||
|
|
||||||
parser.add_argument('--copy', action="store_true", help="copy the client side JS to clipboard")
|
parser.add_argument('--copy', action="store_true", help="copy the client side JS to clipboard")
|
||||||
|
parser.add_argument('--assemble', nargs=2, help="assemble the file INFILE and write the resultant overrides to OUTFILE")
|
||||||
parser.add_argument('--run', help="specify file to start the desmos server for")
|
parser.add_argument('--run', help="specify file to start the desmos server for")
|
||||||
parser.add_argument('--overrides', help="specify file that contains overrides for desmos expressions")
|
parser.add_argument('--overrides', help="specify file that contains overrides for desmos expressions")
|
||||||
|
|
||||||
|
|
||||||
|
def entry():
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
prog="desmosisa",
|
||||||
|
description="a smörgåsbord of utilities for desmos, including some implementations of an desmos-based isa",
|
||||||
|
)
|
||||||
|
|
||||||
|
define_args(parser)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
if args.overrides:
|
if args.overrides:
|
||||||
args.overrides = get_overrides(args.overrides)
|
args.overrides = get_overrides(args.overrides)
|
||||||
|
0
desmosisa/asm.py
Normal file
0
desmosisa/asm.py
Normal file
@ -96,8 +96,10 @@ async def serv(websocket, file, overrides={}):
|
|||||||
)
|
)
|
||||||
|
|
||||||
async def start_server(file, overrides):
|
async def start_server(file, overrides):
|
||||||
|
print("starting server")
|
||||||
wrapper = functools.partial(serv, file=file, overrides=overrides)
|
wrapper = functools.partial(serv, file=file, overrides=overrides)
|
||||||
async with serve(wrapper, "localhost", 8765):
|
async with serve(wrapper, "localhost", 8764):
|
||||||
|
print("starting server for realz")
|
||||||
await asyncio.Future()
|
await asyncio.Future()
|
||||||
|
|
||||||
def main(file, overrides):
|
def main(file, overrides):
|
||||||
|
16
setup.py
Normal file
16
setup.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import setuptools
|
||||||
|
setuptools.setup(
|
||||||
|
name='desmos-sync',
|
||||||
|
version='0.1',
|
||||||
|
author='Ryan Marina',
|
||||||
|
description='synchronize Desmos expressions between the local filesystem and the web calculator',
|
||||||
|
packages=["desmossync"],
|
||||||
|
entry_points = {
|
||||||
|
"console-scripts": [ "desmos-sync=desmossync.cli.entry" ]
|
||||||
|
},
|
||||||
|
install_requires=[
|
||||||
|
'setuptools',
|
||||||
|
'websockets',
|
||||||
|
'watchdog'
|
||||||
|
]
|
||||||
|
)
|
12
shell.nix
12
shell.nix
@ -1,10 +1,4 @@
|
|||||||
{ pkgs ? import <nixpkgs> {} }:
|
{ pkgs ? import <nixpkgs> {} }:
|
||||||
let
|
pkgs.mkShell {
|
||||||
my-python-packages = ps: with ps; [
|
nativeBuildInputs = with pkgs.python311Packages; [ websockets watchdog pyperclip ];
|
||||||
pip
|
}
|
||||||
pkgs.python311Packages.websockets
|
|
||||||
pkgs.python311Packages.watchdog
|
|
||||||
pkgs.python311Packages.pyperclip
|
|
||||||
];
|
|
||||||
my-python = pkgs.python3.withPackages my-python-packages;
|
|
||||||
in my-python.env
|
|
||||||
|
Loading…
Reference in New Issue
Block a user