4,052 questions
0
votes
0
answers
43
views
How to build a gcc_tree_node from custom language Nodes
Nodes:
building a gcc_tree_node for a custom prograimming language
compile and base on C++26
the modules are avilable
the language using tab-block system
every keyword start with '/'
I want to ...
0
votes
2
answers
164
views
I'm writing a parser in C++ for my programming language, but I don't figure out how to represent token trees [closed]
I want to create a parser in C++ for my programming language. Its logic is a little different than usual, because I want to first organize tokens in blocks (such as expressions or IDs, that are ...
2
votes
1
answer
29
views
How do I add a table to a Nytril Document?
I have the Nytril IDE installed and need to add a pie table to my document. I have looked through the tutorial but I am having trouble getting the table to appear.
I tried this, but it doesn't work.
...
3
votes
2
answers
212
views
Is there a way in *any* JVM language to implement two interfaces with some method(s) with the same signature but different return types
So, I need to have an object implement two interfaces that both require a method with the same signature as each other, but different return types. Something like these two:
interface FooPrinter {
...
0
votes
1
answer
107
views
Does C11, C99 or C23 have a PEG specification?
Is there a PEG parser for C language?
Is there any list of programming languages with a PEG specification?
-2
votes
1
answer
91
views
How to make minimal CRT (C Runtime) in the elf x86_64 file
I want make CRT (C, C++, Rust use CRT). For what? For my own compiler, i means which minimal suite of functions need for preparing main(argc, argv, envp, auxp, program_name, stack).
How did I know ...
1
vote
1
answer
109
views
Dart multiple generic type evaluation
I saw an article about the Result pattern on the official flutter site(https://docs.flutter.dev/app-architecture/design-patterns/result), and I thought it was a good structure, so I tried to apply it ...
-1
votes
1
answer
143
views
Does ruby create a temporary variable when you type a number literal?
I am working on my own language and wondering how other language do things. When I am using irb for example and just type a number like "5" I get:
irb(main):001:0> 5
=> 5
irb(main):003:...
0
votes
1
answer
67
views
Python library pydub, exit code -1073741819
I am making a program where I need to play files many times. When I play a file, it plays, but after 2 seconds the program closes with exit code -1073741819.
Code: "
from pydub import ...
0
votes
0
answers
25
views
What is the meaning of `=>` in Lustre?
In Lustre v6 syntax rules, there is a => expression
Expression ::= ...
| Expression => Expression
...
It seems that => accepts 2 boolean operands and also returns ...
1
vote
1
answer
55
views
Segmentation fault encountered at `ret void` in llvm-ir instructions
I'm currently making a compiler that outputs bare LLVM-IR instructions and implementing variadic function calls. I have defined a println function that accepts a (format) string and variable amount of ...
0
votes
1
answer
131
views
Problem with custom LLVM-IR for my compiler
I'm currently working on programming language compiler that generated LLVM-IR. I'm not using any library for the emitting, so I'm just writing instructions to a file. The problem is mutable variables, ...
0
votes
1
answer
72
views
If everything is an object in Python, how is the value of a primary type stored?
In Python, everything is an object. I'm fine with this. If I inspect a list or even a float, I can see there is a class associated with that data. But at the end of the day, if I make an value
x = 1, ...
0
votes
1
answer
91
views
I'm writing a programming language in Python, but I have a problem with the lexer function
I'm writing a programming language in Python, but I have a problem with the lexer function.
I'll leave you the code, which is fully functional:
import sys
inputError = """
(!) Error.
(...
-2
votes
2
answers
1k
views
Are there any Pine script alternatives now? [closed]
I've been using Pine Script on TradingView to develop custom trading indicators, but I'm looking to explore other options. I'm particularly interested in languages and platforms that might offer more ...
-1
votes
1
answer
65
views
Dynamic scoping evaluation
I'm currently taking a course about programming languages and trying to solve the following question, given the code in SML syntax, assume SML using dynamic scoping, what would be the value of the ...
0
votes
1
answer
87
views
How much performance of current hardware is left out due to SW (higher-level programming languages)?
I was wondering how much potential performance of our current HW is unused due to higher level programming languages (here I consider C and C++ to be high level languages).
Of course I know that it ...
-1
votes
1
answer
51
views
Does mallocing a space of 3*sizeof(float) and creating an array of floats of size 3 do the basically the same thing in C?
My question is if writing this line: float* array = malloc(3*sizeof(float));
Is equivalent of writing: float array[3];
If not, why?
(i'm reaaally new to C)
I noticed that when i try to manipulate the ...
-3
votes
1
answer
100
views
Wrong results of using sizeof operator in C++ [closed]
I have a question regarding the sizeof() operator.
If you can see my code below in the pic:
When I used sizeof(command), it showed me that the number of bytes was equal to 28:
When I counted by ...
0
votes
1
answer
228
views
Single operator floor division
What programming languages other than Python has the floor division as a single operator from the programmers' point of view?
Why does it even exist? Please don't give me the answer of because it can!
...
1
vote
1
answer
119
views
How can passing the `IO ()` to `main` be considered pure?
I don't quite understand how printing (outputting to the screen) can be considered pure in a programming languages sense, but I was claimed to that such a concept exists in Haskell.
You create an IO ()...
0
votes
0
answers
113
views
Infinite loop for user-defined list_length
Here is a list length method:
list_length([], 0).
list_length([_|T], N) :- list_length(T, TN), N is TN + 1.
If I query list_length(X, 1) and pass over the first answer, it infinite loops. Here's a ...
0
votes
1
answer
83
views
Prolog evaluation of unknown variables [duplicate]
Consider this:
list_length([], 0).
list_length([H|T], N) :- list_length(T, N - 1).
It doesn't give a compilation error, but it doesn't work.
my thinking is:
suppose i call list_length([1], N)
we ...
0
votes
0
answers
67
views
Effect on time complexity of defining function argument in different ways
in a problem using void solve(int index,string &s,vector<vector> &ans,vector &temp) passes all test cases where as void solve(int index,string s,vector<vector> &ans,vector &...
0
votes
1
answer
73
views
Bison ID reduction conflict
I'm working on a simple programming language, writing it from scratch, and using Flex and Bison.
This language recognizes simple arithmetic expressions and imperative variable statements.
I'm having a ...
2
votes
1
answer
583
views
How to add support for my programming language on GitHub?
I have my own programming language, and I want to make it appear in the list of languages in a repository. However, I can't find any answers to this question in the documentation. Can someone please ...
0
votes
0
answers
28
views
How does a program store variables? [duplicate]
When I declare a variable in, let's say C:
int x;
The compiler allocates memory, and assigns a memory address to that variable.
When I reference the variable again, the compiler generates some ...
3
votes
1
answer
256
views
Overloaded Subprograms in Ada
Our Programming Languages professor told us that:
"In Ada, the return type of an overloaded function can be used to disambiguate calls (thus two overloaded functions can have the same parameters)&...
0
votes
2
answers
152
views
Java bytecode not in .class file
I'm working on a personal project just for fun, a new programming languages (just because there are not enough). I m going to make it run on JVM but I need to store some metadata in the compiled file. ...
0
votes
1
answer
119
views
Which programming languages don't treat if as syntax?
In which programming languages is a conditional block (if) not syntactically different than a function invocation, including any "else" block of code to be executed in the false condition? ...
0
votes
1
answer
130
views
How to implement mutual calling between different programming language by shared library?
Recently, I have been interested in how Apache can support Python WSGI. After researching, I found out that there is a mod_python module, which is a shared library written in C. Furthermore, I also ...
0
votes
1
answer
45
views
How does the value of an untouched integer change here? [duplicate]
This really, really messed with me today. This is the most minimum working example I could get:
array = [ 1, 2, 1, 3, 4 ]
n = 3 ...
0
votes
0
answers
70
views
How to make Intellij highlight and collapse code (in your own language)?
I'm making my own programming language. But now I want Intellij to highlight my new language and also - and that is very important for me - to collapse code blocks. What I mean by that is the ...
0
votes
1
answer
149
views
SICP Environment Diagram with Mermaid.JS
I'm trying to draw an environment diagram, as defined in SICP (see here), programmatically, such that a diagram will be associated with an evaluation of an expression. I'm testing Mermaid.js for that ...
1
vote
0
answers
114
views
Is this a reasonable way to construct the syntax node of an abstract syntax tree in C++ (or is there a safer or more memory-efficient construction)?
I am writing a (most likely bottom-up) parser for a new general-purpose programming language. My parser takes in a stream of tokens. For completeness, here is the token_t.
struct token_t {
// Kind ...
0
votes
1
answer
379
views
Naming of the General Rust Raw String Literal Technique
In Rust, a raw string literal (emphasis mine):
...start with the character U+0072 (r), followed by fewer than 256 of the character U+0023 (#) and a U+0022 (double-quote) character. The raw string ...
0
votes
1
answer
40
views
How is class property assigned in constructor call without being a parameter
I don't get behind the magic of these kind of calls, especially the second argument:
[DllImport("Kernel32.dll", CharSet = CharSet.Auto)]
The constructor of DllImport is called with two ...
0
votes
0
answers
144
views
Where is the _start function
Here is a minimal example:
int main (int argc, char **argv) {}
and then
% gcc main.c && otool -xv a.out
a.out:
(__TEXT,__text) section
_main:
0000000100003f9e pushq %rbp
0000000100003f9f ...
1
vote
0
answers
132
views
Would an ECS-specific programming language be helpful?
I've thought about creating a programming language specifically for developing ECS, but I do not have enough experience to conclude whether or not it would be useful at all or not. Can anyone give me ...
0
votes
2
answers
868
views
Why are arrow methods not allowed in Typescript?
The suggestions to allow arrow methods in Typescript have been rejected on the basis on "changing Javascript as language". How would it exactly change the language to have one less character ...
1
vote
2
answers
94
views
How to handle Python exceptions in a decent way?
I am developing an online service with python. Since it is an ONLINE service, I do not want the service down under any circumstances. So I add lots of try.. except... to make sure that if anything bad ...
1
vote
1
answer
201
views
What causes this equivalent code in Go and C to output differently?
I am learning about programming languages and trying to learn about the design principles behind them. Below is code for C and Golang for a simple test of associativity and precedence.
#include <...
0
votes
1
answer
142
views
Antlr adding additional parameters to visit methods, accommodations for continuation passing style
I am trying to do continuation passing style for a simple programming language made with antlr. Typically you would have an eval procedure that takes as arguments the expression to be evaluated as ...
0
votes
0
answers
91
views
Which Lang is the fastet for working with xlsx-Files
i have an xlsx file with some sheets. What I want to do, is to Programming a small GUI that read out 150 Cells show the user up to 50 inputboxes and take the inputboxes-Value into an other sheet.
Is ...
1
vote
2
answers
130
views
why is `(((call/cc (lambda (k) k)) (lambda (x) x)) "HEY!")` evaluated to "HEY!"?
I am reading The scheme programming language and seeing this example in continuation section:
(((call/cc (lambda (k) k)) (lambda (x) x)) "HEY!") => "HEY!"
I cannot figure out ...
4
votes
1
answer
1k
views
What is the correct approach to create a custom GoTo Definition behavior in VS Code extension?
I am creating a VS Code extension that supports a small proprietary language. One of the minimal requirements for it is to have a "Go To Definition" functionality for procedures only. Being ...
1
vote
0
answers
88
views
Techniques and terminology for learning a massive code base
This question is not specific to one programming language in particular, and perhaps intended to help someone who isn't formally trained in programming.
I have always worked on my own and without any ...
6
votes
3
answers
925
views
What is the difference between a declarator and a direct-declarator?
In The C Programming Language, 2nd Edition, by authors Brian W. Kernighan and Dennis M. Ritchie, they talk about declarators and direct-declarators. The discussion starts in the book on p. 122 with ...
1
vote
0
answers
78
views
How do JavaScript runtimes implement binding functions to objects? [duplicate]
I'm implementing a JavaScript interpreter, and I can't figure out the details of binding functions to objects in JavaScript.
A rudimentary example:
const o = {
x: 1,
getX: function() {
return ...
1
vote
0
answers
66
views
How do I count whitespace lexemes (token)?
I'm studying programming language with ocw(stanford).
x=0;\n\twhile (x < 10) { \n \tx++; \n }
I understood that consecutive space,\n,\t count as one whitespace token. But in the lecture, it says ...