summaryrefslogtreecommitdiff
path: root/parser/expr.go
AgeCommit message (Collapse)Author
5 daysfeat: add support for range clause and iteratorsMarc Vertes
- vm: added Pull, Next and Stop instructions, to implement iterators - lang: add Range, Next and Stop tokens - parser: handle range clause. Still naive and incomplete. - comp: generate iterator instructions from range clause. Work in progress. Only initial support for slices. Many more tests and combinations needed, but the main pattern is there now.
10 daysfeat: handle slice expressionsMarc Vertes
13 daysfix: improve literal composite on nested typesMarc Vertes
2026-01-11fix: handle assign statements on map elementsMarc Vertes
A new token MapAssign is added to implement assignements involving a map, slice or array, an index key expression and a value expression.
2026-01-09feat: initial support for mapsMarc Vertes
2026-01-08fix: improve composite literal for slicesMarc Vertes
2026-01-07fix: improve handling of composite literal struct expressionsMarc Vertes
2026-01-06Merge branch 'main' of git.vertes.org:git/parscanMarc Vertes
2026-01-06fix: correct and simplify parsing of expressions.Marc Vertes
The expressions were parsed from right to left, and it was incorrect and cumbersome. Now they are processed from left to right, with a simpler and correct handling of precedence rules. The vm function call syntax has been changed to set the function before the input arguments on the stack, as to follow the declaring order in languages.
2025-12-19fix lang: attribute properties to tokens, not stringsMarc Vertes
2025-12-04chore: move symbol types and functions in its own package.Marc Vertes
2025-12-03feat: support literal struct expressions with keyed elementsMarc Vertes
2025-11-27chore: move compiler and interpreter in their own packagesMarc Vertes
2025-11-10chore: fix lintMarc Vertes
2024-07-18fix (parser): don't panic if assign of define untyped value (#10)Marc Vertes
* fix (parser): don't panic if assign of define untyped value In case of defining or assigning to untyped value, the type has to be taken from the source value instead of the target value. The vm test coverage has also been slightly improved. * fix and simplify Token.Name() * improve parser errors
2024-04-23feat: initial and partial support of composite expressions (#9)Marc Vertes
A new `Composite` token is created. Literal composite expressions are recognized and partially handled by the parser but not yet by the code generator. Other cosmetic changes are present.
2024-04-02chore: add linters and some lint fixes (#8)Marc Vertes
* chore: add linters and some lint fixes Configure some golangci-lint linters to get the code quality right. Apply the first fixes. Next step will be to add github actions to run lint and tests in github CI. * chore: more lint, fixed comments and variable names. no semantic change. * chore: add Makefile This makefile is intended to be used as a local substitute to github actions.
2024-03-22feat: add initial support for import, provide minimal fmt (#6)Marc Vertes
The `import` statement is now parsed. It only provides minimal support for the `fmt` package (only `Println` symbol is defined). This should be sufficient to pass a few tests. Full support of package namespaces, source and binary imports will be supported later, based on this work.
2024-03-14feat: improve debug output of tokensMarc Vertes
2024-03-14Merge branch 'main' of github.com:mvertes/parscanMarc Vertes
2024-03-14feat: initial support of closuresMarc Vertes
Also detection and automatic execution of main function. Make sure that all debug is output to stderr.
2024-03-13Merge pull request #5 from ajnavarro/fix/small-fixesMarc Vertes
Fix: small README fixes and throw an error if expression not supported.
2024-03-12Fix: small README fixes and throw an error if expression not supported.Antonio Navarro Perez
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2024-01-15chore: import from gnolangMarc Vertes
2023-11-20parser: add pointer support (work in progress)Marc Vertes
This is incomplete because the scalar variables are not addressable right now. To be addressable they must be represented as reflect values, not interfaces.
2023-11-20parser: add support for unary operatorsMarc Vertes
2023-11-20parser: add support for slices and arrays, parse index expressionsMarc Vertes
2023-11-17parser: support selector expression to get / set struct fieldsMarc Vertes
The structures are reresented by reflect values. New instructions `Field` and `Vassign` have been added to the VM to assign reflect values and access struct fields.
2023-11-15parser: parse struct type declarationsMarc Vertes
Recursive structs and embedded structs are not supported yet.
2023-11-04fix: skip parsing empty expressionMarc Vertes
2023-11-03feat: add support for control flow operators in expressionsMarc Vertes
Logical operators `&&` (and), `||` (or) are now parsed in expressions. The control flow tokens (labels, conditional jumps) are added accordingly.