gitignore fix

This commit is contained in:
jusax23 2022-10-15 11:15:20 +02:00
parent 4e46f693a8
commit db2e96588d
9 changed files with 205 additions and 66 deletions

135
.gitignore vendored Normal file
View file

@ -0,0 +1,135 @@
./node_modules/
./test.lisp
./test.mms
./test.mmo
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
.cache
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

View file

@ -1,7 +1,23 @@
import { link } from "fs";
import { error } from "./lexer.js"; import { error } from "./lexer.js";
export class context{ export class context{
#list = {}; #list = {};
#types = {
u8: { size: 1,type: 0, content: false },
u16: { size: 2,type: 0, content: false },
u32: { size: 4,type: 0, content: false },
u64: { size: 8,type: 0, content: false },
i8: { size: 1,type: 1, content: false },
i16: { size: 2,type: 1, content: false },
i32: { size: 4,type: 1, content: false },
i64: { size: 8,type: 1, content: false },
f32: { size: 4,type: 2, content: false },
f64: { size: 8,type: 2, content: false },
char: {link:"u8"},
bool: {link:"u8"},
b: {link:"bool"},
};
constructor(){ constructor(){
console.log("create"); console.log("create");
} }
@ -18,6 +34,16 @@ export class context{
if(!elem) error("Can not find '"+name+"' in context!"); if(!elem) error("Can not find '"+name+"' in context!");
return elem; return elem;
} }
getType(name){
let type;
do{
if (type) type = this.#types[type.link]
else type = this.#types[name];
}while(type.link);
return type;
}
build(){ build(){
let out = ` let out = `
LOC Data_Segment LOC Data_Segment

View file

@ -2,8 +2,8 @@ import { createType, error, LISPcmd } from "./lexer.js";
import { convertType, getOutType } from "./types.js" import { convertType, getOutType } from "./types.js"
export default { export default {
"+": ({execute, data, target, nid, ctx}) => { "+": ({ execute, data, target, nid, ctx }) => {
let params = data.array.slice(1).map((d, i) => execute({data:d, target:target + (i ? 0 : 1)})); let params = data.array.slice(1).map((d, i) => execute({ data: d, target: target + (i ? 0 : 1) }));
let outType = getOutType(...params.map(d => d.type)); let outType = getOutType(...params.map(d => d.type));
return { return {
type: outType, type: outType,
@ -15,23 +15,56 @@ export default {
return [ return [
d.code, d.code,
convertType(d.type, outType, target + 1), convertType(d.type, outType, target + 1),
` ${(["ADDU","ADD","FADD"])[outType]} $${target},$${target},$${target+1}` ` ${(["ADDU", "ADD", "FADD"])[outType]} $${target},$${target},$${target + 1}`
]; ];
}).flat(Infinity).join("\n") }).flat(Infinity).join("\n")
} }
}, },
defvar: ({ execute, data, target, nid, ctx })=>{ "-": ({ execute, data, target, nid, ctx }) => {
let params = data.array.slice(1).map((d, i) => execute({ data: d, target: target + (i ? 0 : 1) }));
let outType = getOutType(...params.map(d => d.type));
return {
type: outType,
code: params.map((d, i) => {
if (i == 0) return [
d.code,
convertType(d.type, outType, target)
];
return [
d.code,
convertType(d.type, outType, target + 1),
` ${(["SUBU", "SUB", "FSUB"])[outType]} $${target},$${target},$${target + 1}`
];
}).flat(Infinity).join("\n")
}
},
defvar: ({ execute, data, target, nid, ctx }) => {
let param = data[3]; let param = data[3];
let [type,d] = createType(param); let [type, d] = createType(param);
if(type == "var" || type == "code"){
error("devfar with input is not implemented yet.",...param.pos)
}else{
ctx.add({ name: data[1]+"V", size: (Number(data[2].substring(1)) ?? 64) / 8, amount: 1, type: (((["u","i","f"]).indexOf(data[2].substring(0,1))+1)||1)-1,content:param }); let varType = ctx.getType(data[2]);
if (varType.content) error("A variable only can be created with a primitive Type.", ...data[2].pos);
if (type == "var" || type == "code") {
error("devfar with input is not implemented yet.", ...param.pos)
} else {
ctx.add({ name: data[1] + "V", size: varType.size, amount: 1, type: varType.type, content: param });
return { return {
code:"", code: "",
type:0 type: 0
} }
} }
},
defarr: ({ execute, data, target, nid, ctx }) => {
let param = data.slice(3).map(d => Number(d));
let varType = ctx.getType(data[2]);
let amount = param.reduce((v, c) => v * c, 1);
ctx.add({ name: data[1] + "V", size: varType.size, amount: amount, type: varType.type, content: param });
return {
code: "",
type: 0
};
} }
} }

13
node_modules/.package-lock.json generated vendored
View file

@ -1,13 +0,0 @@
{
"name": "lisptommix",
"version": "0.0.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"node_modules/fs": {
"version": "0.0.1-security",
"resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
"integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w=="
}
}
}

9
node_modules/fs/README.md generated vendored
View file

@ -1,9 +0,0 @@
# Security holding package
This package name is not currently in use, but was formerly occupied
by another package. To avoid malicious use, npm is hanging on to the
package name, but loosely, and we'll probably give it to you if you
want it.
You may adopt this package by contacting support@npmjs.com and
requesting the name.

20
node_modules/fs/package.json generated vendored
View file

@ -1,20 +0,0 @@
{
"name": "fs",
"version": "0.0.1-security",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/npm/security-holder.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/npm/security-holder/issues"
},
"homepage": "https://github.com/npm/security-holder#readme"
}

View file

@ -1,2 +0,0 @@
(defvar x:u16 5)
(+ 5 x)

BIN
test.mmo

Binary file not shown.

View file

@ -1,11 +0,0 @@
LOC Data_Segment
GREG @
xV WYDE 5
LOC #100
Main SET $1,5
//no type conversion nessesary
LDWU $0,xV
//no type conversion nessesary
ADDU $0,$0,$1