thetawom / stark Goto Github PK
View Code? Open in Web Editor NEWCompiler for beginner-friendly programming language
Compiler for beginner-friendly programming language
Add support for allocating/de-allocating arrays, accessing elements, etc.
For arrays of non-primitive types like strings, the values should be properly initialized after allocation, e.g. to null pointers.
Have the program throw a null pointer error if it attempts to dereference a null pointer.
Right now each time there is an instruction with the chance of throwing errors, a new "error" basic block is created. Would be a lot neater and more scaleable to have one basic block created per function for the purpose of throwing any error, and some sort of global pointer to an error message that it will print. This way a new basic block doesn't need to be created every time.
Comparison operators (=, !=, >, <, >=, <=) are supported for int
and float
types. However, they are currently being implemented with operators from Llvm.Icmp
, which only works for integers. IR generation needs to check the type of the the operands and use the appropriate operator from either Icmp
(for integers) or Fcmp
(for floats), similar to what is currently being done for the arithmetic operators.
New feature to automatically cast ints to floats. e.g. 1.0 + 2
would produce 3.0
instead of throwing an illegal binary operator error.
When tilde operators are nested, there is sometimes strange behavior with items being printed twice.
For example, printc( ~ (~ (~ 'a' as int) + 1) as char )
prints a 97 98 b
but ~ (~ (~ (~ 'a' as int) + 1) as char )
(replacing the outermost printc
with ~
) prints a 97 98 a 97 98 b
.
Currently, for loops only supports integer variables. We should have it work for floats too.
Currently printf
always prints 0.0 regardless of the value passed in. Needs to be fixed.
Currently for loops only work when ascending (i.e. for positive increments) because the compiler uses the lte
comparison operator. Would be nice to have it work for negative increments as well. One idea is to require the increment to be an integer and not an expression so that its sign can be easily checked for at compile time and the appropriate comparison operator used.
Need to add feature for casting data types, with the following syntax: i <- j as int
Would be nice to have a built-in length function for arrays return the number of elements (e.g. length({1, 2, 3})
returns 3
).
Have each array index be checked against the size of the array (should be relatively simple because the size is explicitly stored in the array's wrapping struct). If not a valid index, throw an out-of-bounds error and exit the program.
Add support for casting char
data types to string
data types (e.g. 'a' as char
returns "a"
).
Currently, tilde logging only supports integer types (and bools). Needs to support floats, chars, and strings.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.