open-index/open-npm huggingface dataset:
npm package: 16ttac-sim
Description: 16 Bit Transport Triggered Architecture CPU Simulator
Latest version: 2.0.1

# 16TTAC-sim

A compiler and simulator written in TypeScript for an imaginary 16bit
[Transport Triggered Architecture](https://en.wikipedia.org/wiki/Transport_triggered_architecture) CPU.

# The CPU

- Uses the TTA architecture
- Up to 128 sources and destinations each
- Accumulator and Address registers
- 16-bit fixed width instruction, with optional 16-bit operand
- 64 kiloword, or 128KB RAM size
- 256-word stack
- Conditional execution using Carry and Zero flags
- Halting support
- Built-in IO support

### Instruction structure:

- bits 15-9 - source
- bits 8-2 - destination
- bit 1 - if set, instruction is only executed if the carry flag is set
- bit 0 - if set, instruction is only executed if the zero flag is set

### Sources and destinations:

All sources and destinations are completely customizable, but you can look [here](docs/src-dest.md) to see the descriptions of all of them that are available by default.

# The assembly language

Here is a small code snippet that should explain the whole syntax:

```
//Comments are single line

//Some example variable declarations:
word var = 123
word var2 = 0x5
word string[10] = "hello"
word string2[10] = [09,98,'c']
word MUL_ARR[10][2] = [[0,1], [2,3], "a"]

//Some example instructions:
SOURCE => DESTINATION
SOURCE => DESTINATION c //Executes only if the carry flag is set
SOURCE => DESTINATION z //Executes only if the zero flag is set
SOURCE => DESTINATION c z //Executes only if the carry and the zero flag are set

//Source can also be a constant value, provided by the operand
123 => DESTINATION
0xFFFF => DESTINATION
'a' => DESTINATION

//Source can also be a reference to a variable
string => ADR
var2 => ADR

//Labels:
label:
123 => ACC
another_label:
string => PUSH
```

# The Toolchain

The toolchain is written in TypeScript, it is made to work both in web and node.
It also works as a standalone tool that you can use with npx.

# Using 16TTAC-sim as an npx tool

```
$ npx 16ttac-sim -h
$ npx 16ttac-sim examples/numbers.txt
```

# Using 16TTAC-sim as a library

```
$ npm i 16ttac-sim

//Include the required files...

const parser = new Parser();
const compiler = new Compiler();
const program = new Command();

let simRunning = true;
const sim = new Sim({
  haltCallback: () => {
    console.log("\n\nHalting");
    simRunning = false;
  }
});

sim.initializeMemory(compiler.compile(parser.parse(sourceCode)));

while(simRunning) sim.singleStep();
```

For more complicated examples with IO, look at [cli.ts](src/cli.ts) and [sim.test.ts](tests/sim.test.ts).

# Adding your own instructions

The main advantage of Transport Triggered Architecture is the ease of adding custom instructions, to do so you can extend the [defaultInstructionDictionary](src/instructionDictionary.ts)
or you can create your own dictionary.

### Important:

A dictionary needs one source with `isOperand` set for the toolchain to work correctly.
npm package: 17-publish-component-library
Description: ## Base Depenencies
Latest version: 1.0.3

# Publish Component Library

## Base Depenencies

```sh
yarn add --dev \
    rollup \
    rollup-plugin-babel \
    rollup-plugin-node-resolve \
    rollup-plugin-commonjs \
    @babel/core \
    @babel/preset-env \
    @babel/preset-react

yarn add --peer \
    react \
    styled-components
```

## Bundle

```sh
yarn bundle
```

By [Rollup](https://github.com/rollup/rollup)

- -c, --config <filename> Use this config file (if argument is used but value
  is unspecified, defaults to rollup.config.js)
- -f, --format <format>: Type of output (amd, cjs, esm, iife, umd)
  - use esm for frontend component library

Plugins:

- [rollup-plugin-node-resolve](https://github.com/rollup/rollup-plugin-node-resolve): Use the Node.js resolution algorithm with Rollup (formerly rollup-plugin-npm)
- [rollup-plugin-commonjs](https://github.com/rollup/rollup-plugin-commonjs): Convert CommonJS modules to ES2015
- [rollup-plugin-babel]():

## Publish

```sh
yarn publish
```

## Usage

```sh
yarn add react styled-components 17-publish-component-library
```

```js
import { Spinner } from "17-publish-component-library";

<Spinner />;
```

[Demo](https://codesandbox.io/embed/practice-17-publish-component-library-2p8tj)
npm package: 178518demo
Description: [![NPM version](https://img.shields.io/npm/v/178518demo.svg?style=flat)](https://www.npmjs.org/package/178518demo) [![node version](https://img.shields.io/badge/node.js-%3E=_8.11.3-green.svg?style=flat)](http://nodejs.org/download/) [![Build](https://img.
Latest version: 0.0.2

# 178518demo

[![NPM version](https://img.shields.io/npm/v/178518demo.svg?style=flat)](https://www.npmjs.org/package/178518demo)
[![node version](https://img.shields.io/badge/node.js-%3E=_8.11.3-green.svg?style=flat)](http://nodejs.org/download/)
[![Build](https://img.shields.io/travis/178518/myDemo.svg)](https://travis-ci.org/178518/myDemo)
[![NPM Count](https://img.shields.io/npm/dt/178518demo.svg?style=flat)](https://www.npmjs.org/package/178518demo)
[![License](https://img.shields.io/npm/l/178518demo.svg?style=flat)](https://www.npmjs.org/package/178518demo)


## Install

```shell
npm i 178518demo
```


[![178518demo](https://nodei.co/npm/178518demo.png)](https://npmjs.org/package/178518demo)


# React Compontent 开发规约

组件通过内容分发实现值传递，尽量避免props传递。

# 编译器安装

```
npm install -g less autoprefixer postcss-cli

npm install karma karma-jasmine -g
```

# WebStorm配置自动编译

使用WebStorm的自动编译功能，实现对less文件的自动编译，使用postcss的autoprefixer插件实现自动补全功能。

## WebStorm配置

### Less

一般情况下来说，WebStorm会自动检测你电脑中是否已经安装了lessc并获取它的安装位置，然后自动帮你配置。

![Less配置](http://photo.yupoo.com/178518/HwQZvmZV/DVerm.png)

```
WebStorm > Preference > Tools > File Watchers

$FileName$ $FileNameWithoutExtension$.css --source-map

$FileNameWithoutExtension$.css:$FileNameWithoutExtension$.css.map
```

### Autoprefixer

打开Webstorm设置，Preferences -> Tools -> External Tools ;点击新增按钮，如图：

![Autoprefixer](http://photo.yupoo.com/178518/HwQZvt23/xTVjo.png)

![keymap](http://photo.yupoo.com/178518/HwQZvwVZ/o0FcY.png)

```
-u autoprefixer -o $FileDir$/$FileName$ $FileDir$/$FileName$

$ProjectFileDir$
```

现在打开你的WebStrom在css文件按shift+A看看会发生什么神奇的事情吧 😄


# 目录结构

目录规范：
├── dist						      # 编译过的源码,npm发布目录
├── examples						  # 编译过的源码,npm发布目录
│ ├── src
│ │ ├── index.html
│ │ ├── index.js
├── src								    # 组件源码
│ ├── assets
│ │ ├── index.less
│ ├── index.js
├── tests							    # Jest测试相关
│ ├── .babelrc
│ ├── .editorconfig
│ ├── .gitignore
│ ├── HISTORY.md				  # 版本历史相关
│ ├── LICENSE						  # 版权申明
│ ├── README.md					
│ ├── package.json
│ ├── webpack.config 		  # 项目开发demo的时候 需要用到的webpack