GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - yujqiao/cppc: A skeleton C compiler in C++

BranchesTags
Open more actions menu

Latest commit

 

History

95 Commits
95 Commits

Folders and files

NameName
Last commit message
Last commit date
tests
tests
 
 
.gitignore
.gitignore
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
ast.cc
ast.cc
 
 
ast.h
ast.h
 
 
cmdargs.cc
cmdargs.cc
 
 
cmdargs.h
cmdargs.h
 
 
context.cc
context.cc
 
 
context.h
context.h
 
 
gen_reserve.py
gen_reserve.py
 
 
llvm.cc
llvm.cc
 
 
llvm.h
llvm.h
 
 
log.h
log.h
 
 
main.cc
main.cc
 
 
object.cc
object.cc
 
 
object.h
object.h
 
 
parser.cc
parser.cc
 
 
parser.h
parser.h
 
 
run_test
run_test
 
 
scanner.cc
scanner.cc
 
 
scanner.h
scanner.h
 
 
testfile
testfile
 
 
token.cc
token.cc
 
 
token.h
token.h
 
 
type.cc
type.cc
 
 
type.h
type.h
 
 
visitor.cc
visitor.cc
 
 
visitor.h
visitor.h
 
 

Repository files navigation

cppc

C compiler in C++

Background

This is a learning project for Crafting interpreters.

Most part of C is supported. Support for pointer is hacky. See tests/ for the supported part.

For which part is supported, see test code under tests/.

Dependencies

Graphviz binary and llvm must be installed. llvm headers are required. Linker commands are dependent on platform and distribution. See the link function in object.cc.

Usage

Compile

make

Test

make test

Run

./clox SOURCE

And then ./a.out, ./output.o, ./output.dot and ./output.png are genereated.

./a.out is the executable file.

./output.o is the object file.

./output.dot is the dot description of the AST.

./output.png is the graph generated according to ./output.dot

Leftover

Generally speaking, the type system is a whole mess. Basic types (int, double, char, bool) works, and arrays should work in most case.

Other things are like:

  • Pointer is not supported.
  • Pointer arguments are supported but in a hacky way.
  • Array is partly supported.
  • Struct and unions are not supported.

About

A skeleton C compiler in C++

Resources

Readme
Activity

Stars

12 stars

Watchers

1 watching

Forks

2 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.