Repository navigation
Conversation
compiler/src/parser.flow: parse function pointer types (A, B) -> R in flowc_parse_type. Stored as AST_TYPE with ival=-1, a=param chain, b=return type. Also skip unit Name declarations (KW_UNIT). compiler/src/cgen.flow: emit function pointer types as R (*)(A, B) in flowc_cgen_emit_type, and R (*name)(A, B) in flowc_cgen_emit_param. compiler/src/token.flow: add KW_UNIT (27). compiler/src/lexer.flow: add "unit" keyword. lib/stdlib/dsp.flow and lib/stdlib/units_si.flow now compile to valid C with zero errors. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
(A, B) -> Rare now parsed and emitted asR (*)(A, B)in C output. Parameter declarations emitR (*name)(A, B).unit Namedeclarations are now skipped (used byunits_si.flowfor SI unit definitions).Context
dsp.flowuses function pointer parameters likef: (f32) -> f32for element-wise mapping.units_si.flowusesunit Second,unit Meter, etc. for dimensional analysis. Neither was handled by the self-hosted compiler.Test plan
./flow run compiler/src/main.flowpasses (flowc: PASS)lib/stdlib/dsp.flowcompiles to valid C with zero clang errorslib/stdlib/units_si.flowcompiles to valid C with zero clang errorsfunction apply(f: (i32) -> i32, x: i32) -> i32 { return f(x) }produces correct CThis pull request includes code written with the assistance of AI.
The code has not yet been reviewed by a human.
Generated with Devin