Skip to content
This repository has been archived by the owner on Jul 4, 2020. It is now read-only.

Rasphino/SPL-Compiler

Repository files navigation

SPL-Compiler

使用C++与LLVM实现的简单SPL编译器

依赖

  • LLVM 9.0
  • C++ 17 standard

编译

mkdir build; cd build
cmake ..
make

运行

./splc input.spl

输出

  • output.ll

LLVM IR。

  • output.s

本机汇编代码。 可以通过 gcc -no-pie output.s 生成本机可执行文件。

  • aarch64.s

aarch64汇编, target = aarch64-pc-linux。可以通过 aarch64-linux-gnu-gcc -no-pie -static aarch64.s 编译,使用 qemu-aarch64 ./a.out 运行。

  • ast.json

AST节点信息,用于visualize.html 可视化

Checklist

  • 数组 一维
  • record实现
  • 常量不可被重新赋值
  • 类型检查
  • 函数调用
  • 乘除
  • 加减区分 real integer
  • var: call by reference
  • write, writeln
  • read
  • 变量自动赋初值
  • Factor: T_NOT_FACTOR T_MINUS_FACTOR
  • 倒序访问是否有问题
  • 主程序返回值

功能

  1. SPL基本语法
  2. 可视化AST

open visualize.html

  1. 代码生成(default target和aarch64)

default target可在本机编译运行,检查正确性。 aarch64为扩展实现。

  1. 超简单的错误提示。

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published