Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>RosettaNew to Visual Studio Code? Get it now.
Rosetta

Rosetta

Ghotihub

|
52 installs
| (0) | Free
C11, ARM assembly, and BNF/EBNF syntax highlighting
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Rosetta

A VSCode extension that provides C11, ARM assembly, and BNF/EBNF syntax highlighting.

Features

  • Complete C11 syntax highlighting for .playground files
  • ARM assembly syntax highlighting for .s and .asm files
  • BNF and EBNF syntax highlighting for .bnf, .ebnf, and .grammar files
  • Support for highlighting:
    • Functions, variables, and other syntax elements in C11
    • Instructions, registers, directives, and labels in ARM assembly
    • Rules, terminals, non-terminals, and operators in BNF/EBNF
    • Comments, strings, and constants in all languages

Installation

From VS Code Extension Marketplace

  1. Open VS Code
  2. Click on the Extensions icon
  3. Search for "Rosetta"
  4. Click Install

From VSIX

  1. Download the latest .vsix file
  2. In VSCode, open the Extensions view
  3. Click on the "..." menu and select "Install from VSIX..."
  4. Select the downloaded .vsix file

From Source Code

  1. Clone the repository
  2. Navigate to the extension directory
  3. Run npm install -g vsce (if vsce is not installed)
  4. Run vsce package to generate a .vsix file
  5. Follow the steps above to install the generated .vsix file

Usage

After installation:

  • All files with the .playground extension will automatically use C11 syntax highlighting
  • All files with .s and .asm extensions will use ARM assembly syntax highlighting
  • All files with .bnf, .ebnf, and .grammar extensions will use BNF/EBNF syntax highlighting

Examples

C11 Example

#include <stdio.h>

// This is a C11 example code
int main(void) {
    // C11 variable declarations
    int arr[5] = {1, 2, 3, 4, 5};
    _Atomic int atomic_var = 10;

    // C11 generic selection expression
    int type = 1;
    int value = _Generic(type,
                        int: 0,
                        float: 1,
                        default: 2);

    printf("Hello, Rosetta!\n");
    return 0;
}

ARM Assembly Example

/*
 * ARM汇编示例
 */

.section .text
.global _start

@ 这是一个简单的ARM汇编程序

_start:
    // 设置栈指针
    mov sp, #0x8000

    ; 加载参数
    mov r0, [#1](https://github.com/ghotihub/rosetta/issues/1)      @ 输出到标准输出
    ldr r1, =message
    ldr r2, =message_end
    sub r2, r2, r1  @ 计算消息长度

    /* 系统调用 */
    mov r7, [#4](https://github.com/ghotihub/rosetta/issues/4)      @ write系统调用
    svc 0           @ 触发系统调用

BNF/EBNF Example

/*
 * BNF语法示例
 */

// 这是一个简化的JSON语法定义
<json> ::= <object> | <array>

<object> ::= "{" [ <members> ] "}"

<members> ::= <pair> | <pair> "," <members>

<pair> ::= <string> ":" <value>

<value> ::= <string> | <number> | <object> | <array> | "true" | "false" | "null"

/* EBNF示例 */
(* EBNF使用不同的注释样式 *)

# SQL查询的简化EBNF定义
query = select_clause, from_clause, [where_clause], ";" ;

select_clause = "SELECT", column_list ;

column_list = column, {",", column} ;
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft