c272 / cobalt Goto Github PK
View Code? Open in Web Editor NEWAn optimising COBOL compiler, built on modern code generation in Rust.
An optimising COBOL compiler, built on modern code generation in Rust.
We can perform incredibly basic boolean expression optimisations on conditional expressions (e.g. removing things like NOT NOT
). This should improve code size and performance for evaluating branch conditions.
There are also code generation time optimisations that can be made here, as Cranelift has support for combined operations such as bor_not
which can represent a NOT X OR Y
and band_not
which can represent a NOT X AND Y
.
Currently, compile-time errors raised from the code generator do not provide any context as to the location or line number of the error. We're already passing the span relevant for each statement into the code generator, we might as well make use of it!
It might also be worth adding additional spans for specific variables, etc. for richer context than just "this line".
Currently, if a PIC signifies an integer, Cobalt will always generate an i64
, which is inefficient when there is no sign bit specified in the PIC. Perhaps we could generate these as u64
instead.
This may require a rework of some code generation functions, and how Pic
signifies its typing (e.g. removal of is_str
and is_float
and implementation of some enum).
Currently, only duplicate data symbols and duplicate paragraph symbols are verified before code generation time, each separately. We should also check for data symbol collisions with paragraph names and vice versa.
Currently, every time a variable is loaded, the GV is imported into the function with declare_data_in_func
and then that GV is turned into a pointer (for strings) or loaded (for ints, floats).
This creates a bucket-load of duplicate GVs and values which we don't need if they're already defined in this function. Perhaps create a ValueManager
(similar to the existing DataManager
) and cache these GV/Value references throughout the function?
Related to the static analysis from #5, it would be nice to cull any unreferenced paragraphs from the code generation output from the results of a prior analysis pass, and warn the user that they have an unused function.
Currently, with the introduction of paragraphs, the user can forgo entering a "STOP RUN" clause since the compiler currently has no ability to perform a walk of the call graph to determine whether the program will at some point (theoretically) enter a terminating block.
Perhaps a verify_ast
function or something similar should be introduced to perform a static analysis pass before the code generation stage. Does not impact functionality, returns still work as expected, this is just not ideal from the user or compliance perspective.
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.