asutton / beaker-cc Goto Github PK
View Code? Open in Web Editor NEWThe Beaker Programming Language
License: Apache License 2.0
The Beaker Programming Language
License: Apache License 2.0
Recent changes that introduced the use of the C++ standard library function std::to_string()
cause compiler errors when building Beaker with GCC on platforms where the system C library is newlib (e.g. Cygwin). This is a documented defect of libstdc++ (see asutton/origin#2) that has only been fixed recently in GCC 6.0, which is still under development.
Possible solutions include the workaround that is currently used in Origin, using std::ostringstream
, or C++ Format.
Invalid type identifiers in field declarations produce free(): invalid pointer error.
@asutton @thehexia: The current implementation of the code generation routines for the &&
and ||
operators in beaker/generator.cpp use the llvm::IRBuilder::CreateAnd()
and llvm::IRBuilder::CreateOr()
member functions, which produce instructions for the bitwise AND and OR operations, respectively—not the logical AND and OR (as I assume was the intention).
From llvm/IR/IRBuilder.h:
Value *CreateAnd(Value *LHS, Value *RHS, const Twine &Name = "") {
if (Constant *RC = dyn_cast<Constant>(RHS)) {
if (isa<ConstantInt>(RC) && cast<ConstantInt>(RC)->isAllOnesValue())
return LHS; // LHS & -1 -> LHS
if (Constant *LC = dyn_cast<Constant>(LHS))
return Insert(Folder.CreateAnd(LC, RC), Name);
}
return Insert(BinaryOperator::CreateAnd(LHS, RHS), Name);
}
Value *CreateOr(Value *LHS, Value *RHS, const Twine &Name = "") {
if (Constant *RC = dyn_cast<Constant>(RHS)) {
if (RC->isNullValue())
return LHS; // LHS | 0 -> LHS
if (Constant *LC = dyn_cast<Constant>(LHS))
return Insert(Folder.CreateOr(LC, RC), Name);
}
return Insert(BinaryOperator::CreateOr(LHS, RHS), Name);
}
FYI, I verified this myself using a test program—llvm::IRBuilder::CreateAnd()
and llvm::IRBuilder::CreateOr()
produce the 'and' and 'or' instructions, respectively.
The program below segfaults (stack overflow) when generating the LLVM type.
struct S { s : S&; }
The generator needs to track which types have been defined instead of blindly recursing.
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.