kodek16 / colang-scala Goto Github PK
View Code? Open in Web Editor NEWA CO language compiler, designed for programming contests and olympiads.
License: MIT License
A CO language compiler, designed for programming contests and olympiads.
License: MIT License
Allow writing number literals like this: 1_000_000
. Underscores are ignored and can be added at arbitrary positions.
Right now the only supported integer type is int
, which is a signed 32-bit integer. This length is often too small, and sometimes too large. To give user more control, the following signed integer types should be supported:
int8
int16
int32
int64
int
- alias for int64
Type names are self-explanatory. int
is changed to an alias for int64
. This is debatable, but the main reasoning is that int
overflows are far more common when coding in C++ than they should be. Making 64-bit integers the default should prevent such nasty bugs.
Make read
a specifier that is allowed on local variables and has the following effect:
read int a, b
is equivalent to
int a, b
readl(a)
readl(b)
The overloaded function read
will have to be renamed: readl
is used above (from 'read late'), but other options are welcome as well.
Add a var
keyword, that can appear instead of type in variable and field definitions. Variables defined as such will have their type inferred from the initializer type: var a = 5
is equivalent to int a = 5
.
Variable definitions with var
but without initializer should be considered invalid.
The syntax should allow defining variables of different types in a single statement like this:
var a = 3.14, b = true
This is equivalent to:
double a = 3.14
bool b = true
Add an error
statement that unconditionally terminates the program (like exit()
. It may also print an error message if used like error "Some message."
.
Code flow analysis routines (e.g. unreachable code checker) must handle error
s correctly.
Implement hexadecimal and binary int
literals starting with 0x
and 0b
respectively.
Add a new function definition syntax that allows to rewrite functions and methods of form
int sum(int a, int b) {
return a + b
}
to look like
int sum(int a, int b) = a + b
Generic types are a must-have feature for designing a convenient standard library. All container types are generic by nature, even the most basic ones like constant-length array.
The semantics we'd like to have are close to C++'s templates, except only typename
parameters are allowed. Compilation time calculations will be likely eventually supported in a different form.
The main problem in implementing generic types is designing a robust type-checking system that allows compiler to find invalid generic type instantiations and report them in a readable way. The proposed solution for this problem is a trait system, which will be described in a separate issue. The initial generic implementation should only allow operations supported by all types (construction and assignment). This should be enough to implement basic collections.
The proposed syntax is the same as in C++ and Java: angle brackets for type parameters (e.g. Vector<T>
).
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.