Giter Site home page Giter Site logo

microc's Introduction

microc

解释器 interpc

# 编译解释器 interpc 命令行程序
dotnet restore interpc.fsproj     # 可选
dotnet clean interpc.fsproj       # 可选
dotnet build -v n interpc.fsproj  # 构建 ./bin/Debug/net6.0/interpc,-v n 查看详细生成过程

# 执行解释器
./bin/Debug/net6.0/interpc example/ex_interpc.c 8
dotnet run --project interpc.fsproj example/ex_interpc.c 8
dotnet run --project interpc.fsproj -g example/ex_interpc.c 8  # 显示token AST 等调试信息

# one-liner
# 自行修改 interpc.fsproj  解释example目录下的源文件
#
# <MyItem Include="example/origin.c" Args ="8"/>
dotnet build -t:ccrun interpc.fsproj

优化编译器 microcc

dotnet restore microcc.fsproj
dotnet clean microcc.fsproj
dotnet build microcc.fsproj

# 两种方式执行
dotnet run --project microcc.fsproj example/ex_microcc.c  # 执行编译器(运行前需 clean)
./bin/Debug/net6.0/microcc example/ex_microcc.c           # 直接执行

虚拟机构建与运行

# dotnet
dotnet clean machine.csproj
dotnet run --project machine.csproj -t example/ex_machine.out 3  # 运行虚拟机(运行前需 clean),-t 查看跟踪信息
./bin/Debug/net6.0/machine -t example/ex_machine.out 3           # 直接执行

# c
gcc -o machine machine.c                   # 编译 c 虚拟机
./machine example/ex_machine.out 3         # 虚拟机执行指令
./machine -trace example/ex_machine.out 3  # -trace 查看跟踪信息

microc's People

Contributors

dparticle avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.