brack-lang / brack Goto Github PK
View Code? Open in Web Editor NEWA bracket-based lightweight markup language that extends commands with WebAssembly
License: Apache License 2.0
A bracket-based lightweight markup language that extends commands with WebAssembly
License: Apache License 2.0
Diagnostic is a feature defined the Language Server Protocol that highlights warnings and errors in the editor, based on the results of code analysis.
For more information on the LSP specification and implementation, refer to the following Japanese documents:
Implementing the full functionally is challenging, so please impl;ement a function equivalent to sendPublishDiagnostics
that can display a set of fixed errors.
We are aiming to enhance the completion feature in our language server by enabling the extraction of function signatures from Wasm modules. To achieve this, we plan to integrate the capability to analyze Wasm modules and retrieve their functions and corresponding type signatures. The tool modsurfer will be instrumental in this process, as it provides the necessary functionality to dissect and understand the structure of Wasm modules.
現状の実装では脚注を実装できない。
特定のコマンドを特別視することはBrackの**に反するので、別の解決策を取りたい。
コマンドはcontext
を受け取る
マクロを実装してASTを変更する
現在はHTMLジェネレータのみが拡張可能であるが、トークン列<
と>
に囲まれたマークアップをマクロであると解釈して、パーザを拡張可能にする。
現在は以下の3行目のマークアップで、コロンによってecho "Hello
、 "
、 name
、"!"
の4引数が#
コマンドに渡されると解釈される。しかし現実にはecho "Hello, ", name, "!"
が1引数で渡される必要があり、何らかの方法でエスケープを導入する必要がある。
{* 標準出力}
[# echo]プロシージャは文字列にキャスト可能な型を持つ可変長引数を受け取って標準出力します。
[# echo "Hello, ", name, "!"]
`
や\
などのトークン列を特別なコマンドとしてエスケープを実装する手段も考えられるが、なるべくBrack自体が意味を持つコマンドを実装することは避けたい。そこで、マクロを導入する。
{* 標準出力}
[# echo]プロシージャは文字列にキャスト可能な型を持つ可変長引数を受け取って標準出力します。
[# <\ echo "Hello, ", name, "!">]
マクロは、コマンド名と以下のBrackの抽象構文木を受け取る。
bnkArgument
bnkText
echo "Hello
bnkArgument
bnkText
"
bnkArgument
bnkText
name
bnkArgument
bnkText
"!"
エスケープが必要な場合は、受け取った引数ノードを1つの引数ノードに連結して返却することで上手く動作すると考えられる。
入れ子状態のマクロが書かれることも考えられるが、特に実装が思いついていないのでまずは1レベルのマクロの実装に取り組む。
The README file should include sections on installation (using Nix and Cargo), build methods, compilation instructions, how to use the language server, how to participate in development, how to make plugins, licensing information, and CI badges.
brack/brack-tokenizer/src/utils.rs
Line 77 in 8bcdb6b
There are the tokenizer, the parser, the macro expander, the code generator, and the language server inside one crate.
However, these must be divided into multiple crates because complexity will increase as the specification grows.
脚注マクロの実装のために可変長引数が必要。フッターに置く脚注要素を引数に持つfootnoteFooterコマンドを実装したいため。
seq[string]
型の引数を可変長引数と見なす。
複数の装飾で、かつほぼデフォルトのコマンドの組み合わせであるような場合、次のようなマークアップになる。
[* [/ [# [@ text, #]]]]
しかしこれは煩雑である。また、新しいコマンドを定義しても良いが再利用されない場合もやや億劫。
そこで次のようなパイプをサポートすることでシンプルな実装を可能にする。
[* | / | # | @ text, #]
[* | / | @ text, # | #]
多引数が混在した時に非常に読みづらくなるのでここまで書いたがいらないかもと思い始めた
To align with Language Server Protocol, I need to modify the structure of TokenData
to Location
as part of the implementation process for the language server.
Specifically, I plan to transition from the current structure:
pub struct TokenData {
pub line: usize,
pub column: usize,
}
to the following structure, in compliance with the protocol:
struct LocationRangePos {
line: usize,
character: usize,
}
struct LocationRange {
start: LocationRangePos,
end: LocationRangePos,
}
pub struct Location {
pub uri: String,
pub range: LocationRange,
}
This change will ensure that our implementation adheres to the standardized format defined by the Language Server Protocol.
現状のパーサは雰囲気で書かれていて、しかもかなり壊れている。
再帰下降構文解析をするように実装をし直す。
The tokenizer is currently implemented to return values of type Vec<Token>
. However, tokenization can fail, and in such cases, it would be more appropriate for the function to return a Result<Vec<Token>, Error>
to properly handle potential errors.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.