Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GNU-R BC compiler WIP #8

Merged
merged 46 commits into from
Feb 14, 2024
Merged

GNU-R BC compiler WIP #8

merged 46 commits into from
Feb 14, 2024

Conversation

fikovnik
Copy link
Member

@fikovnik fikovnik commented Feb 13, 2024

A partial implementation of the GNU-R BC compiler.

Missing:

  • 11.4 Inlining simple .Internal functions
  • 12 The switch function
  • 13 Assignments expressions
  • 16 Improved subset and sub-assignment handling
  • A simple interpreter for the constantFoldCode
  • A logger for warnings

There are also a bunch TODO/FIXME mostly related to cumbersome code that could be improved by better SEXP API. This is to be expected - this is the first "client" of the SEXPs.

The BcLabel for simplicity is mutable so the spotbugs is complaining.

# Conflicts:
#	pom.xml
#	src/main/java/Main.java
#	src/main/java/org/prlprg/bc/Bc.java
#	src/main/java/org/prlprg/bc/BcCode.java
#	src/main/java/org/prlprg/bc/BcInstr.java
#	src/main/java/org/prlprg/bc/BcLabel.java
#	src/main/java/org/prlprg/bc/BcOp.java
#	src/main/java/org/prlprg/bc/ConstPool.java
#	src/main/java/org/prlprg/compile/Compiler.java
#	src/main/java/org/prlprg/compile/Context.java
#	src/main/java/org/prlprg/compile/package-info.java
#	src/main/java/org/prlprg/primitive/Logical.java
#	src/main/java/org/prlprg/rds/RDSReader.java
#	src/main/java/org/prlprg/sexp/Attributes.java
#	src/main/java/org/prlprg/sexp/CloSXP.java
#	src/main/java/org/prlprg/sexp/ComplexSXP.java
#	src/main/java/org/prlprg/sexp/EnvSXP.java
#	src/main/java/org/prlprg/sexp/ExprSXP.java
#	src/main/java/org/prlprg/sexp/IntSXP.java
#	src/main/java/org/prlprg/sexp/LangSXP.java
#	src/main/java/org/prlprg/sexp/LglSXP.java
#	src/main/java/org/prlprg/sexp/ListSXP.java
#	src/main/java/org/prlprg/sexp/LocalEnvSXP.java
#	src/main/java/org/prlprg/sexp/NilSXP.java
#	src/main/java/org/prlprg/sexp/RealSXP.java
#	src/main/java/org/prlprg/sexp/RegEnvSXP.java
#	src/main/java/org/prlprg/sexp/RegSymSXP.java
#	src/main/java/org/prlprg/sexp/SEXP.java
#	src/main/java/org/prlprg/sexp/SEXPType.java
#	src/main/java/org/prlprg/sexp/SEXPs.java
#	src/main/java/org/prlprg/sexp/SpecialEnvSXP.java
#	src/main/java/org/prlprg/sexp/StrOrRegSymSXP.java
#	src/main/java/org/prlprg/sexp/StrSXP.java
#	src/main/java/org/prlprg/sexp/SymSXP.java
#	src/main/java/org/prlprg/sexp/TaggedElem.java
#	src/main/java/org/prlprg/sexp/VecSXP.java
#	src/main/java/org/prlprg/sexp/VectorSXP.java
#	src/main/java/org/prlprg/util/IO.java
#	src/main/java/org/prlprg/util/Nothing.java
#	src/main/java/org/prlprg/util/Pair.java
#	src/test/java/org/prlprg/bc/BcTests.java
#	src/test/java/org/prlprg/bc/CompilerTest.java
#	src/test/java/org/prlprg/rds/RDSReaderTest.java
#	src/test/java/org/prlprg/util/Tests.java
# Conflicts:
#	.idea/inspectionProfiles/Project_Default.xml
#	src/main/java/Main.java
#	src/main/java/org/prlprg/bc/BcCode.java
#	src/main/java/org/prlprg/bc/BcInstr.java
#	src/main/java/org/prlprg/compile/Compiler.java
#	src/main/java/org/prlprg/compile/CompilerException.java
#	src/main/java/org/prlprg/rds/RDSReader.java
#	src/main/java/org/prlprg/sexp/CloSXP.java
#	src/main/java/org/prlprg/sexp/SEXP.java
#	src/main/java/org/prlprg/util/Pair.java
#	src/test/java/org/prlprg/bc/CompilerTest.java
#	src/test/java/org/prlprg/rds/RDSReaderTest.java
#	src/test/java/org/prlprg/rsession/package-info.java
#	src/test/snapshots/org/prlprg/bc/basics.R/arithmetic.ast.rds
#	src/test/snapshots/org/prlprg/bc/basics.R/arithmetic.bc.rds
#	src/test/snapshots/org/prlprg/bc/basics.R/block_with_one_expression.ast.rds
#	src/test/snapshots/org/prlprg/bc/basics.R/block_with_one_expression.bc.rds
#	src/test/snapshots/org/prlprg/bc/basics.R/calls.ast.rds
#	src/test/snapshots/org/prlprg/bc/basics.R/calls.bc.rds
#	src/test/snapshots/org/prlprg/bc/basics.R/conditions.ast.rds
#	src/test/snapshots/org/prlprg/bc/basics.R/conditions.bc.rds
#	src/test/snapshots/org/prlprg/bc/basics.R/empty_block.ast.rds
#	src/test/snapshots/org/prlprg/bc/basics.R/empty_block.bc.rds
#	src/test/snapshots/org/prlprg/bc/basics.R/nested_function.ast.rds
#	src/test/snapshots/org/prlprg/bc/basics.R/nested_function.bc.rds
I simply do not know how to get around the UnnecessaryImport issue caused by wildcard (on-demand) import.
@fikovnik fikovnik merged commit 56b67c2 into main Feb 14, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant