Masicalan.Core 0.2.0-preview.1

This is a prerelease version of Masicalan.Core.
dotnet add package Masicalan.Core --version 0.2.0-preview.1
                    
NuGet\Install-Package Masicalan.Core -Version 0.2.0-preview.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Masicalan.Core" Version="0.2.0-preview.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Masicalan.Core" Version="0.2.0-preview.1" />
                    
Directory.Packages.props
<PackageReference Include="Masicalan.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Masicalan.Core --version 0.2.0-preview.1
                    
#r "nuget: Masicalan.Core, 0.2.0-preview.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Masicalan.Core@0.2.0-preview.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Masicalan.Core&version=0.2.0-preview.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Masicalan.Core&version=0.2.0-preview.1&prerelease
                    
Install as a Cake Tool

Masicalan Core

Masicalan Core は,マクロ記述スクリプト言語 Masicalan のインタプリタライブラリです.

開発環境

Microsoft Windows 11 Insider Preview Experimental<br> Visual Studio 2026<br> .NET 10.0

概要

Masicalan は動的型付けのスクリプト言語で,以下のような機能を備えています:

  • 値型: 整数 (IntVal),小数 (FloatVal),文字列 (StringVal),真偽値 (BoolVal),配列 (ArrayVal)
  • 演算子: 算術演算 (+, -, *, /, ^),比較演算 (<, >, ==),論理演算 (&&, ||)
  • 制御構文: 変数定義,代入,if-else,while ループ,関数定義,戻り値

基本的な使い方

Interpreter.Run - シンプルな実行

最もシンプルな使い方は Interpreter.Run を使用することです:

let script = "printn(\"Hello World!\");"
let env = script |> Interpreter.Run

Interpreter.Run はスクリプトをパースして実行し,実行後の環境状態を Evaluator.EnvironmentState 型で返します.

EnvironmentState の構造

返り値の EnvironmentState には以下の情報が含まれています:

type EnvironmentState = {
	VariablesEnv : Map<string, Value>                    // 変数環境
	FunctionsEnv : Map<string, string list * Statement>  // 関数環境
}

スクリプト実行後の変数や関数に以下のようにアクセスできます:

let env = script |> Interpreter.Run

// 変数の参照
let maybeValue = env.VariablesEnv.TryFind("variableName")

// 関数の参照
let maybeFunction = env.FunctionsEnv.TryFind("functionName")

Interpreter.RunWithExt - 拡張機能を使った実行

初期変数や初期関数をインジェクションしてスクリプトを実行する場合は,Interpreter.RunWithExt を使用します:

let script = "let result = add(10, 20);"

// 初期変数を定義
let initialVars = Map.ofList [("productName", StringVal "MyProduct")]

// 初期関数を定義
let initialFuncs = Map.ofList [("add", (["a"; "b"], CallNativeF(...)))]

let env = Interpreter.RunWithExt script initialVars initialFuncs

このような,初期変数と初期関数をインジェクションする仕組みを Masicalan Extension と呼びます. 外部データの利用やアプリケーションが実装した関数をインジェクションすることで, マクロ言語としての拡張性を提供します.

使用しているライブラリ

FParsec

パーサの実装に FParsec を利用しています.

Copyright (c) 2007–2017, Stephan Tolksdorf. All rights reserved.<br> ライセンス: BSD 2-clause License<br> FParsec のライセンス詳細

更新履歴

ver.0.2.0-preview.1

  • exit文の実装.
  • 不変変数と可変変数を実装.
  • メタデータ機能を実装.
  • その他軽微な修正.

ver.0.1.0-preview.0

  • 初回プレリリース版
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0-preview.1 55 9/10/2026
0.1.0-preview.0 73 6/27/2026