@maxfield/casl2-language
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

casl2-language

Build Status Coverage Status

casl2-languageはCASL2の言語解析機能を持つライブラリです。

Features

AST

ASTを生成します。 API: createSourceFile

import * as casl2 from "@maxfield/casl2-language";

// SourceFileはASTのトップノードです。
const sourceFile = casl2.createSourceFile(path, src);

// 例
// [LAD     GR2, 3] の場合
{
    "kind": "InstructionLine",
    "start": 39,
    "end": 61,
    "instructionCode": {
        "kind": "InstructionCode",
        "start": 47,
        "end": 50,
        "raw": "LAD"
    },
    "operands": {
        "kind": "Operands",
        "start": 55,
        "end": 61,
        "operands": [
            {
                "kind": "Operand",
                "start": 55,
                "end": 58,
                "op": {
                    "kind": "GR",
                    "start": 55,
                    "end": 58,
                    "raw": "GR2"
                }
            },
            {
                "kind": "Operand",
                "start": 60,
                "end": 61,
                "op": {
                    "kind": "Constant",
                    "start": 60,
                    "end": 61,
                    "const": {
                        "kind": "DecConstant",
                        "start": 60,
                        "end": 61,
                        "raw": "3"
                    }
                }
            }
        ]
    }
}

Author

Maxfield Walker

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @maxfield/casl2-language

Weekly Downloads

3

Version

1.0.0

License

MIT

Last publish

Collaborators

  • maxfield