-
Notifications
You must be signed in to change notification settings - Fork 1
FAQ
-
What is Concoct?
Concoct is an imperative, dynamically-typed, interpreted, general-purpose programming language written in C. -
What does imperative mean?
Imperative programming is a paradigm involving a sequence of instructions or steps (an algorithm) that modify a program's state. Popular imperative programming languages include C, C#, C++, Go, Java, JavaScript, Lua, Perl, PHP, Python, Ruby, and many others. The aforementioned languages differ from declarative programming languages such as Haskell or SQL. In an imperative language, a computer is instructed how to solve a problem whereas in a declarative language, a computer is informed what results are to be obtained. -
What exactly is a "state change"?
Programs written in imperative languages have their state changed during runtime. For example, a counter used in a loop is often incremented as in the case of variable i below. Each time the value of i is incremented, this constitutes a change in state.for(int i = 0; i <= 100; i++) printf("%d\n", i);
-
Speaking of paradigms, is Concoct object oriented?
Concoct will initially be procedural. However, support for objects is a planned goal for the language. Concoct will be similar to C++ and Ruby in this regard in that you can use procedural or object-oriented programming in your programs. -
What do you mean by procedural?
A procedural language such as C uses functions (also called procedures or subroutines) to perform tasks. These functions typically contain sequences of instructions to execute. In object-oriented languages such as Java, variables (data members) are often contained in a class along with functions (methods in this context). Lastly, functional languages such as Haskell apply the concept of mathematical functions (f(x)) and recursion while avoiding state changes to solve problems. Examples of each are below./* sum() is a function that takes 2 integers and returns the sum as an integer */ int sum(int x, int y) { return x + y; } sum(3, 5); /* calling the sum() function yields 8 */
// Person is a class containing 2 variables and a method (function within a class) class Person { int age; String name; void printDetails() { System.out.println("Age: " + age); System.out.println("Name: " + name); } } Person person = new Person(); // person is an object of type Person
-- define a function called factorial and recursively call itself to produce result factorial n = if n == 0 then 1 else n * factorial (n - 1) -- call factorial function factorial 10 -- yields 3628800
-
What is meant by dynamically typed and interpreted?
Dynamic typing occurs when the data types within a program are determined at runtime (a feature common in other interpreted languages like Python and Ruby). When the interpreter (Concoct in this case) encounters an assignment operation, it establishes the variable's data type based on the right-hand side of the statement. This is in contrast to static typing which typically occurs during compilation. In a statically-typed language like C, the compiler must be informed of the data type at compile time. Here are examples of both scenarios:/* Note the requirement of the data type to the left of the variable name */ int a = 3; // integer float b = 3.0; // decimal char* c = "Greetings!"; // string
# Note the lack of an explicit data type for each variable a = 3 # Integer b = 3.0 # Float c = "Greetings!" # String
-
Is Concoct strongly or weakly typed?
Concoct is strongly typed. In a strongly-typed language like Ruby, you would not be able to perform the following operation:irb(main):001:0> 3 * '5' Traceback (most recent call last): 3: from /usr/bin/irb:11:in `<main>' 2: from (irb):1 1: from (irb):1:in `*' TypeError (String can't be coerced into Integer)
However, in a weakly-typed language such as JavaScript, the following expression is perfectly legal:
3 * '5'; // yields 15
-
Why is Concoct considered a general-purpose language?
The language is designed to be used for any purpose. Concoct is not limited to a specific scope as with a domain-specific language (DSL) like AWK, HTML, SQL, or XML. The plan is to have a sufficient standard library after the interpreter is functional. -
Who is behind Concoct?
Concoct was created by BlakeTheBlock and Lloyd Dilley in the summer of 2020 after a conversation in Discord. -
Why make another programming language?
This project is mainly driven by the desire to learn. The creators of Concoct also wanted to design a language that they would enjoy using. The goal is to create a straightforward and succinct language with a relatively small number of keywords (and no surprises). -
Is Concoct licensed?
Concoct is licensed under the terms of the 2-clause BSD License. This allows for the modification and/or redistribution of Concoct in binary and source forms so long as the copyright information is retained. This also permits Concoct to be used in proprietary programs. -
Is Concoct's VM register or stack based?
Concoct uses a hybrid stack-based VM with registers.