Feature: Operator precedence #155

Open
opened 2023-08-17 08:08:21 +01:00 by deavmi · 6 comments
Owner

What is this?

To re-work the internals of parseExpression() such that whenever I call it it does the correct precedence.

  • Try not to change to much of the expression types, but you can add to them if required. Just let me know or ask me.
  • Changes should only be in parseExpression() but new methods may be added which it makes calls to.

Todo

  • Operator precedence code on branch of this issue
  • Update grammar documentation (see the docs repo on whatsapp)
    • We need a grammar specification written out as you re-implement the parser's expression stuff. This is very important - the docs are important! Need it as a markdown file.
## What is this? To re-work the internals of `parseExpression()` such that whenever I call it it does the correct precedence. * Try not to change to much of the expression types, but you **can** add to them **if** required. Just let me know or ask me. * Changes should only be in `parseExpression()` but new methods may be added which **it** makes calls to. ### Todo - [ ] Operator precedence code on branch of this issue - [ ] Update grammar documentation (see the docs repo on whatsapp) * We need a grammar specification written out as you re-implement the parser's expression stuff. This is **very** important - the docs are important! Need it as a markdown file.
deavmi added the
parser
qol
labels 2023-08-17 08:08:31 +01:00
gusmeyer was assigned by deavmi 2023-08-17 08:08:36 +01:00
deavmi added the due date 2023-09-02 2023-08-17 08:09:12 +01:00
deavmi added this to the Parser project 2023-08-17 08:09:17 +01:00
deavmi added this to the Basics milestone 2023-08-17 08:09:21 +01:00
deavmi added reference feature/operator_precedence 2023-08-17 09:12:09 +01:00
deavmi added a new dependency 2023-11-06 09:38:39 +00:00
deavmi removed the due date 2023-09-02 2023-12-29 17:50:11 +00:00
deavmi added the due date 2024-02-29 2023-12-29 17:50:18 +00:00
deavmi removed the due date 2024-02-29 2024-03-03 10:01:12 +00:00
deavmi added the due date 2024-03-17 2024-03-03 10:01:33 +00:00
Author
Owner

Brought latest code form vardec_varass_depencency into here

Brought latest code form `vardec_varass_depencency` into here ✅
deavmi modified the due date from 2024-03-17 to 2024-03-31 2024-03-03 11:48:15 +00:00
deavmi added the
needsfix
label 2024-03-03 11:49:05 +00:00
Author
Owner

Minutes:

11+1;

// Interesting to test
11++++++++++++1
11+--1
// + should NOT be a unary operator

1.1 = "1.1"

[11, +, 1]

RetExp: [11] (1)
RetExp: [] (0)

RetExp: [BinOp(lhs, rhs)] (1)

// Array indices
array[getMyIndex(1+1)]

// Unary ops
&, ~, -, *, !

// Shifters
>> << (Might need lexer addition)

// BODMAS
() then / then

DLang Docs: https://dlang.org/spec/grammar.html#expressions

Minutes:

import std.stdio;

x.y.z
["x.y.z."] -> VarExp("x.y.x")
[x,.,y.,x] -> VarExp("x.y.x")

#[]

/**
 * This is my entry point
 */
public void main()
{
	#[inline]
	// int i = myFunc();
	writeln(11+-+-+-+-myFunc());
}

void k()
{
	int i = 1;
	i = 2;
}

#[tags: io, +additonal]
void basicMap(Object d)
{
	File k = open();
	return dsjfkdsjdf;
}

#[defineTags: io]
void open() // Opens a file
{
	
}

#[applyStrat cannot have  tags: (io, ...)]
void apply(void function(Object f) applyStrat, Object[] d)
{
	for every i in d do f(d)
}
Minutes: ``` 11+1; // Interesting to test 11++++++++++++1 11+--1 // + should NOT be a unary operator 1.1 = "1.1" [11, +, 1] RetExp: [11] (1) RetExp: [] (0) RetExp: [BinOp(lhs, rhs)] (1) // Array indices array[getMyIndex(1+1)] // Unary ops &, ~, -, *, ! // Shifters >> << (Might need lexer addition) // BODMAS () then / then ``` **DLang Docs:** https://dlang.org/spec/grammar.html#expressions Minutes: ```d import std.stdio; x.y.z ["x.y.z."] -> VarExp("x.y.x") [x,.,y.,x] -> VarExp("x.y.x") #[] /** * This is my entry point */ public void main() { #[inline] // int i = myFunc(); writeln(11+-+-+-+-myFunc()); } void k() { int i = 1; i = 2; } #[tags: io, +additonal] void basicMap(Object d) { File k = open(); return dsjfkdsjdf; } #[defineTags: io] void open() // Opens a file { } #[applyStrat cannot have tags: (io, ...)] void apply(void function(Object f) applyStrat, Object[] d) { for every i in d do f(d) } ```
deavmi pinned this 2024-04-01 21:29:07 +01:00
deavmi removed a dependency 2024-04-08 11:48:20 +01:00
Author
Owner

Updated with latest base code

Updated with latest base code
Author
Owner

image

![image](/attachments/9744ecee-4e03-48c3-90b0-9d3e104eaa23)
Author
Owner
C precence: https://en.cppreference.com/w/c/language/operator_precedence
deavmi started working 2024-05-05 12:43:03 +01:00
Author
Owner

Added TernaryOperator type

Added `TernaryOperator` type
deavmi removed the due date 2024-03-31 2024-05-05 12:45:29 +01:00
deavmi added the due date 2024-05-31 2024-05-05 12:45:35 +01:00
deavmi stopped working 2024-05-05 12:54:47 +01:00
11 minutes 44 seconds
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Total Time Spent: 11 minutes 44 seconds
deavmi
11 minutes 44 seconds
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

2024-05-31

Dependencies

No dependencies set.

Reference: tlang/tlang#155
No description provided.