cimplec / sim-c Goto Github PK
View Code? Open in Web Editor NEWA dynamically typed high-level front end for C
Home Page: https://cimplec.github.io/docs/
License: GNU General Public License v3.0
A dynamically typed high-level front end for C
Home Page: https://cimplec.github.io/docs/
License: GNU General Public License v3.0
Is your feature request related to a problem? Please describe.
Add support for bitwise operators in simC.
Describe the solution you'd like
Check implementation of other operators.
Note: Discuss the bitwise operators and their syntax with a maintainer before implementing.
Question
Check for armstrong number.
Where to put the code?
In simc-codes directory
What to name the file?
q5.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Question
Perimeter of a rectangle.
Where to put the code?
In simc-codes directory
What to name the file?
q15.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Question
Sum of factorial of digits of a number.
Where to put the code?
In simc-codes directory
What to name the file?
q27.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Question
Finding the roots of a quadratic equation using Sridharacharya's formula.
Where to put the code?
In simc-codes directory
What to name the file?
q35.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
You are saying that the language is dynamically typed, it's not. That's because you cannot change the type of a variable during runtime, I guess it wouldn't work. In fact, this language has type deduction, but It's still statically typed.
Report any bug you encounter while using SimC
Format of Bug Submission
The format can be found in the file bugs/format.txt.
Separate files should be made for different bugs. The extension of all the bug-reports should be .txt
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Note: You only start working on the feature if a maintainer approves that request in discussion.
Question
Sum of two numbers.
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Question
Check if number is palindrome.
Where to put the code?
In simc-codes directory
What to name the file?
q18.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Is your feature request related to a problem? Please describe.
Allowing user to write C code inside simC, this will be just copied and pasted into compiled C code without checking for syntax or compiling.
Describe the solution you'd like
Add two tokens BEGIN_C and END_C between which C code will be written, this should be directly pasted into appropriate location in compiled C code by simC compiler.
simC Code Example
MAIN
var i = 0
print(i)
BEGIN_C
int c = 10;
int* ptr = &c;
printf("%d\n", *ptr);
END_C
END_MAIN
Is your feature request related to a problem? Please describe.
Explicit casting of types from by the user.
Describe the solution you'd like
Syntax will be similar to that of python (e.g. int(3.14159)). After successful type casting the type for the corresponding value should be updated in symbol table.
simC Code Example
MAIN
var i = 3.14159
var int_i = int(i)
print(int_i)
END_MAIN
Question
First 10 fibonacci series.
Where to put the code?
In simc-codes directory
What to name the file?
q6.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Question
Define two string variables and concatenate their values and print the value.
Where to put the code?
In simc-codes directory
What to name the file?
q34.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Question
Least of three numbers.
Where to put the code?
In simc-codes directory
What to name the file?
q24.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Question
Compute the value of following series till nth term.
Where to put the code?
In simc-codes directory
What to name the file?
q32.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Question
Convert decimal number to binary number.
Where to put the code?
In simc-codes directory
What to name the file?
q20.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task.
Is your feature request related to a problem? Please describe.
Implement sizeof operator to return the size of a variable.
Describe the solution you'd like
Whenever sizeof is called the type of the variable should be extracted from symbol table and based on this type return the size. Files to be changes for adding this are lexical_analyzer, parser, and compiler.
Note:- The size should not be static for every machine (e.g. size of an int variable should not return 4 for every machine), the result should be machine dependant and should be computed accordingly.
simC Code Example
MAIN
var i = 3.14159
var size = sizeof(i)
print(size)
END_MAIN
Question
Multiplication of digits of a number.
Where to put the code?
In simc-codes directory
What to name the file?
q17.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Describe the bug
Fails to take scope into account. Final value dicates the initial data type of the var even if they are contradictory in nature.
To Reproduce
simC code:-
var i = "asb"
MAIN
var i = 10
var j = 10
print(i)
END_MAIN
C Code:-
#include <stdio.h>
int i = "asb";
int main() {
int i = 10;
int j = 10;
printf("%d", i);
return 0;
}
Expected behavior
C Code:-
#include <stdio.h>
char* i = "asb";
int main() {
int i = 10;
int j = 10;
printf("%d", i);
return 0;
}
Question
Perimeter of a square.
Where to put the code?
In simc-codes directory
What to name the file?
q14.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Describe the bug
Cannot infer type of parameter inside function body. The type inference here should be done after calling but is being done in the definition itself.
To Reproduce
simC code:-
fun sum(a, b) {
var c = a+b
return c
}
MAIN
var d = sum(1,2)
END_MAIN
C Code:-
Not generated, throws error.
Expected behavior
C Code:-
int sum(int a, int b) {
int c = a+b;
return c;
}
int main() {
int d = sum(1,2)
return 0;
}
Question
Compute the value of following series till nth term.
Where to put the code?
In simc-codes directory
What to name the file?
q33.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
REAMDE goes inside readme-lang folder. The naming convention used is README-(language name).md where (language name) is the name of language in which README is being translated.
Note: Discuss with a maintainer in this thread before starting to translate the README.
Is your feature request related to a problem? Please describe.
Add support for default parameters in functions in simC.
Describe the solution you'd like
Syntax will be similar to that of C.
simC Code Example
fun sum(a, b=2) {
return a + b;
}
MAIN
var result_1 = sum(1)
print(result_1)
result_1 = sum(1, 3)
print(result_1)
END_MAIN
Question
Convert binary number to decimal number.
Where to put the code?
In simc-codes directory
What to name the file?
q19.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Question
Print left lower triangle.
Where to put the code?
In simc-codes directory
What to name the file?
q7.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Question
Print right lower triangle.
Where to put the code?
In simc-codes directory
What to name the file?
q8.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Question
Print diamond shape.
Where to put the code?
In simc-codes directory
What to name the file?
q11.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Is your feature request related to a problem? Please describe.
Implement typeof operator in simC.
Describe the solution you'd like
Simply return the type of variable from symbol table. When typeof is called on a variable.
simC Code
MAIN
var i = 3.14159
typeof(i)
END_MAIN
Question
Sum of digits of number.
Where to put the code?
In simc-codes directory
What to name the file?
q13.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Describe the bug
Error when braces not included after if or any other block statement, when it should take only the immediate line into account.
To Reproduce
simC code:-
MAIN
var i = 0
if(i % 2 == 0)
print("Even")
else
print("Odd")
END_MAIN
C Code:-
Not generated, throws error.
Expected behavior
C Code:-
int main() {
int i = 0;
if(i % 2 == 0)
print("Even")
else
print("Odd")
return 0;
}
Question
Print reverse of a number.
Where to put the code?
In simc-codes directory
What to name the file?
q25.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Question
Define a string variable and print it.
Where to put the code?
In simc-codes directory
What to name the file?
q1.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Question
Print inverted triangle.
Where to put the code?
In simc-codes directory
What to name the file?
q12.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Describe the bug
No check for parenthesis pairs and missing parenthesis towards the end
To Reproduce
simC code:-
MAIN
var i = 1 +(((2)))
END_MAIN
C Code:-
int main() {
int i = 1 + (((2);
return 0;
}
Expected behavior
C Code:-
int main() {
int i = 1 + (((2)));
return 0;
}
Question
Compute the following series till nth term.
Where to put the code?
In simc-codes directory
What to name the file?
q30.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Question
Permutation computation nPx.
Where to put the code?
In simc-codes directory
What to name the file?
q28.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Question
Print left upper triangle.
Where to put the code?
In simc-codes directory
What to name the file?
q9.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Question
Print right upper triangle.
Where to put the code?
In simc-codes directory
What to name the file?
q10.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Is your feature request related to a problem? Please describe.
Dynamic memory allocation in simC.
Describe the solution you'd like
Open ended, come up with an intuitive syntax.
Note: Discuss syntax with a maintainer before implementing.
Question
Maximum and minimum digits of a number.
Where to put the code?
In simc-codes directory
What to name the file?
q22.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Question
Display the sum of even and odd digits of a number.
Where to put the code?
In simc-codes directory
What to name the file?
q16.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Question
Combination computation nCx.
Where to put the code?
In simc-codes directory
What to name the file?
q29.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Question
Check even or odd.
Where to put the code?
In simc-codes directory
What to name the file?
q4.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Question
Check whether a year is leap or not.
Where to put the code?
In simc-codes directory
What to name the file?
q31.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Note: You only start working on the feature if a maintainer approves that request in discussion.
Question
Define a string variable and print it.
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Question
Check if number is prime or not.
Where to put the code?
In simc-codes directory
What to name the file?
q3.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Question
Sum of two numbers.
Where to put the code?
In simc-codes directory
What to name the file?
q2.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Question
Greatest of three numbers.
Where to put the code?
In simc-codes directory
What to name the file?
q23.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
Question
Factorial without recursion.
Where to put the code?
In simc-codes directory
What to name the file?
q26.simc
Note: You can only start doing a question if it has been assigned to you by a maintainer. Once assigned to someone this questions will not be reassigned, it can only be reassigned if the person does not complete his/her task."
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.