Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/16Bitt/libcc
A small library for building simple interpreters and compilers
https://github.com/16Bitt/libcc
Last synced: 2 months ago
JSON representation
A small library for building simple interpreters and compilers
- Host: GitHub
- URL: https://github.com/16Bitt/libcc
- Owner: 16Bitt
- Created: 2016-01-27T13:58:36.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-04-21T04:18:05.000Z (almost 9 years ago)
- Last Synced: 2024-04-24T16:15:20.606Z (9 months ago)
- Language: C
- Size: 20.5 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
- AwesomeInterpreter - libcc
README
LibCC
----------LibCC is a very simple static library for building compilers and interpreters in the same vain as Jack Crenshaw's *Let's Build a Compiler* series, but aimed at a more modern C-style approach
Dependencies
------------This project has next to no dependencies.
* C Compiler
* Make
* C Standard LibraryUsage
------------Most of the usage is covered `libcc.h`, but the basics are as follows:
* `look` is the lookahead character
* Use `libcc_init` to start processing a file
* `error`, `warning`, and `emit` all support `printf` variadic arguments
* `getname`, `getnumber`, and so on all read from the stream
* `peekname` can be used to take a look at the next identifier in the stream
* `match` and `expected` can be used to handle syntax requirementsExamples
--------The best example I have is included with the library! Simply use `make run` and a simple C compiler will be built. Look at the source in the `test/` directory for more information.
Contributing
------------Feel free to add issues for suggestions and needed improvements! This is a small and very young project, but any help is greatly appreciated. In addition, if you need help using it, don't be afraid to ask.