Change intermediate column syntax. (#1630)

Fixes #1190 
Fixes https://github.com/powdr-labs/powdr/issues/1488

```
// creates intermediate column.
let x: inter = ...
// same here, expects an array on the rhs
let x: inter[k] = ...

// Creates an intermediate column, this is printed from Analyzed
col x = ...;
// Creates an array of intermediate columns, this is printed from analyzed and it's actually new syntax.
col x[k] = ...;

// old syntax for intermediate columns, this just defines a "generic variable" after the change,
// essentially an intermediate column that is always inlined.
let x: expr = ...;
```

---------

Co-authored-by: Leo <leo@powdrlabs.com>
This commit is contained in:
chriseth
2024-08-03 15:12:57 +02:00
committed by GitHub
parent 10be8ab355
commit 7ecf0de94b
21 changed files with 391 additions and 146 deletions

View File

@@ -142,7 +142,7 @@ LetStatement: PilStatement = {
}
PolynomialDefinition: PilStatement = {
<start:@L> PolCol <id:Identifier> "=" <expr:Expression> <end:@R> ";" => PilStatement::PolynomialDefinition(ctx.source_ref(start, end), id, expr)
<start:@L> PolCol <name:PolynomialName> "=" <expr:Expression> <end:@R> ";" => PilStatement::PolynomialDefinition(ctx.source_ref(start, end), name, expr)
}
PublicDeclaration: PilStatement = {
@@ -777,6 +777,7 @@ TypeTerm<ArrayLength>: Type<ArrayLength> = {
"fe" => Type::Fe,
"string" => Type::String,
"col" => Type::Col,
"inter" => Type::Inter,
"expr" => Type::Expr,
<base:TypeTerm<ArrayLength>> "[" <length:ArrayLength?> "]" => Type::Array(ArrayType{base: Box::new(base), length}),
"(" <mut items:( <TypeTerm<ArrayLength>> "," )+> <end:TypeTerm<ArrayLength>> ")" => { items.push(end); Type::Tuple(TupleType{items}) },
@@ -845,6 +846,7 @@ SpecialIdentifier: &'input str = {
"loc",
"insn",
"int",
"inter",
"fe",
"expr",
"bool",