Socket
Book a DemoInstallSign in
Socket

mccompiler

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mccompiler

an mini compiler for c-like language

1.1.5
latest
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

建议在linux上使用(推荐:Ubuntu20.04)

prerequste:

  • spim sudo-apt install spim
  • node: 需要14.0以上的版本
  • npm sudo-apt install npm

How to run ?

  • 编译mc代码文件 => 汇编文件: npx mccompiler filename.mc
  • 执行汇编文件: npx run filename.s
  • 安装语法高亮插件:vscode插件市场搜索minic

minic语法:

  • 运算符:支持+-*/运算,支持逻辑运算,不支持运算符结合,如:(2 + 3) * 10
  • 类型:支持自然数(int类型),布尔值以及void
  • 语句:支持函数调用,嵌套的if-else语句(嵌套的if-else语句,注:if-else里必须有return语句,否则会有一些出乎意料的错误)
  • 和C一样,必须要有main函数
  • 变量必须声明的时候同时赋值
  • 内置print函数

eg:

int main() {
  int x = sum(2, 3);
  print(x);
}

int sum(int x, int y) {
  return x + y;
}

FAQs

Package last updated on 06 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.