crust
crust copied to clipboard
C99 compiler toolchain in Rust (for fun and self-education)
`nom` is useful for efficiently and expressively declare parsing functionality
The new compiler should have a reasonable speed
Strings are expensive to compare and store, so in the lexer stage, should convert string to number, use number to compare, store the string with it's index as reference to...
DAG need to be added to avoid same expression multi-node. If there's already an identical expression node exists, just return it, do not generate new node.
Now crust just use a simple AST Printer, which uses the depth as its parameter to control its indention level, but should be improved by ignoring some node information which...
read environment variables and find files under C_INCLUDE_PATH
Add global set to track every include file path+name, and judge whether it has been included. Skip the files that have been already included.
Currently, we only detect only a few of them, but let's not discriminate :)
https://stuff.mit.edu/afs/athena/project/rhel-doc/3/rhel-cpp-en-3/predefined-macros.html
This should help prevent any errors along the way.