qscript-language

所属分类:自动编程
开发工具:C++
文件大小:5505KB
下载次数:0
上传日期:2021-04-14 19:47:21
上 传 者sh-1993
说明:  一种用C++编写的解释性编程语言,包括标记器、IR生成器、代码优化器、字节码编译...
(An interpreted programming language written in C++ including a tokenizer, IR generator, code optimizer, bytecode compiler and a stack-based virtual machine)

文件列表:
.editorconfig (131, 2021-04-15)
.vscode (0, 2021-04-15)
.vscode\c_cpp_properties.json (601, 2021-04-15)
.vscode\launch.json (1073, 2021-04-15)
.vscode\settings.json (1426, 2021-04-15)
CLI (0, 2021-04-15)
CLI\CLI.cpp (3922, 2021-04-15)
CLI\CLI.vcxproj (7307, 2021-04-15)
CLI\CLI.vcxproj.filters (938, 2021-04-15)
Includes (0, 2021-04-15)
Includes\Exception.h (1781, 2021-04-15)
Includes\Instructions.h (2589, 2021-04-15)
Includes\QLibPCH.cpp (21, 2021-04-15)
Includes\QLibPCH.h (574, 2021-04-15)
Includes\QScript.h (1934, 2021-04-15)
LangSrv (0, 2021-04-15)
LangSrv\LangSrv.cpp (8755, 2021-04-15)
LangSrv\LangSrv.vcxproj (7424, 2021-04-15)
LangSrv\LangSrv.vcxproj.filters (942, 2021-04-15)
Library (0, 2021-04-15)
Library\Common (0, 2021-04-15)
Library\Common\Chunk.cpp (1382, 2021-04-15)
Library\Common\Chunk.h (340, 2021-04-15)
Library\Common\Disassembler.cpp (18397, 2021-04-15)
Library\Common\Disassembler.h (1759, 2021-04-15)
Library\Common\Object.h (4068, 2021-04-15)
Library\Common\Value.cpp (1819, 2021-04-15)
Library\Common\Value.h (9877, 2021-04-15)
Library\Compiler (0, 2021-04-15)
Library\Compiler\AST (0, 2021-04-15)
Library\Compiler\AST\AST.cpp (49909, 2021-04-15)
Library\Compiler\AST\AST.h (5287, 2021-04-15)
Library\Compiler\AST\ToJson.cpp (3319, 2021-04-15)
Library\Compiler\AST\Typing.cpp (8987, 2021-04-15)
Library\Compiler\Compiler.cpp (20536, 2021-04-15)
Library\Compiler\Compiler.h (4430, 2021-04-15)
Library\Compiler\IR.h (4051, 2021-04-15)
Library\Compiler\IRGenerator.cpp (33102, 2021-04-15)
... ...

# QScript Language ## Overview QScript is an interpreted programming language written in C++. The project can be compiled on windows with [Visual Studio](https://visualstudio.microsoft.com/) and on OSX via [gcc](https://gcc.gnu.org/). ## Syntax & language features The syntax of QScript could be described as a mix of JavaScript/TypeScript & Objective-C. It offers optional typing similar to TypeScript and borrows some grammar -- such as its function call syntax -- from Objective-C. Feature-wise QScript supports everything from basic variables, loops, control-flow statements, functions and arrays to more advanced features such as tables, closures, automatic garbage collection, optional types and langsrv integrations. Unlike some of my other programming language projects, this is a more or less general purpose programming language that doesn't solve for a specific use-case. ![Example 1 - Hello world](https://github.com/fakelag/qscript-language/blob/master/media/01.gif) ![Example 2 - Array sum](https://github.com/fakelag/qscript-language/blob/master/media/02.gif) ## Installation (Microsoft Windows) - Install Visual Studio 2019 (any with v142 platform toolset will work) - Open `qscript-language.sln` - You can now compile and run any of the projects for x86/x*** release + debug ## Installation (OSX) - Install gcc (g++) - Run ```bash cd OSX sh ./compile_pch.sh # Re-run if Includes/QLibPCH.h gets changed sh ./compile_cli.sh # Compiles CLI project ./Lib/CLI.o --repl # Start CLI in REPL mode ``` ## Tests Repository contains unit and ETE tests in `Tests/`. Most tests are end-to-end tests for 1. modeling real-world use-cases as closely as possible 2. testing all components of the language with a single set of tests 3. depending as little as possible on implementation details and focus on behavior ![Running tests](https://github.com/fakelag/qscript-language/blob/master/media/03.gif) ## Repl CLI contains repl mode which can be used with the `--repl` flag ![Repl mode](https://github.com/fakelag/qscript-language/blob/master/media/04.gif) ## Typing system QScript contains optional compile-time types -- you can choose to use types or ignore them entirely ![Optional types](https://github.com/fakelag/qscript-language/blob/master/media/05.gif) You can check also types with `--typer` CLI flag ```bash Typer> var x = 1; unknown -> none Typer> const y = 1; num -> none Typer> const f = () -> auto { return "hello"; } function -> string ``` ## Language server (& vscode extension) JSON-based language server allows for easy integration of 3rd party software. For example, a vscode language extension ([link to full repo here](https://github.com/fakelag/qscript-lsp)) ![vscode extension](https://github.com/fakelag/qscript-language/blob/master/media/07.gif) ## Debugger Compiling the library with QVM_DEBUG preprocessor define will yield an interactive debugger for programs loaded in the VM ![CLI Debugger](https://github.com/fakelag/qscript-language/blob/master/media/06.gif)

近期下载者

相关文件


收藏者