Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
2a37591
Start migration to more recent Scala & Sbt versions.
two-horned Oct 20, 2025
974d832
Remove build properties
two-horned Nov 4, 2025
e90acd3
Update gitignore.
two-horned Nov 4, 2025
1ac14cd
Migrate to Scala3, Parsers.
two-horned Nov 4, 2025
923ee41
Migrate to Scala3, DerivedOps.
two-horned Nov 4, 2025
14648f7
Migrate CharSnytax.
two-horned Nov 4, 2025
b9cda64
Fix comment, rem semicolons.
two-horned Nov 4, 2025
370326f
Update gitignore.
two-horned Nov 4, 2025
18b6c08
Update build.sbt
two-horned Nov 4, 2025
574bb2a
Migrate library to Scala 3.7.0
two-horned Nov 4, 2025
e766194
Remove new keyword
two-horned Nov 4, 2025
3e63820
Remove duplicate&unused code
two-horned Nov 5, 2025
f19711e
Make infix, remove unncesssary conversion of alias
two-horned Nov 5, 2025
641094d
Replace implicits by givens
two-horned Nov 5, 2025
60ee954
Fight infix warning
two-horned Nov 5, 2025
1b4eda7
Make Section3 work
two-horned Nov 5, 2025
c862098
Make Section 7 work.
two-horned Nov 5, 2025
127e5aa
fight warnings, import implicit conversion
two-horned Nov 5, 2025
1973152
Revert back to cake-pattern
two-horned Nov 5, 2025
026b5db
Simplify lambda.
two-horned Nov 6, 2025
7eb6f6a
formatting and start working on section4
two-horned Nov 6, 2025
b7db52a
Make Section4 work
two-horned Nov 6, 2025
d990c3f
Migrate PythonParsers
two-horned Nov 6, 2025
6fecca5
Migrate Paper.scala
two-horned Nov 6, 2025
3450c45
Remove deprecated use of mutable ListMap
two-horned Nov 6, 2025
a5df706
Start migrating LeftrecTests
two-horned Nov 6, 2025
482889a
Start migrating tests
two-horned Nov 6, 2025
3d5b994
Introduce given. Use backticks. Fix overloaded method
two-horned Nov 6, 2025
c05e450
Remove import statements in favor of cake pattern
two-horned Nov 6, 2025
7416699
All but charParser resolved
two-horned Nov 6, 2025
dcc3d13
Resolve charParser conversion
two-horned Nov 6, 2025
2776516
Use enum
two-horned Nov 6, 2025
3c97ee5
fix comment
two-horned Nov 6, 2025
6f3c88e
formatting
two-horned Nov 7, 2025
95ee303
Remove infix def
two-horned Nov 7, 2025
409b07f
Use trait parameter to avoid conflicting definitions
two-horned Nov 7, 2025
fea56ab
Fix PythonParserTests
two-horned Nov 7, 2025
5d18e4b
Now all compiles, but we have stackoverflow
two-horned Nov 7, 2025
fd67d2d
Update gitignore
two-horned Nov 8, 2025
3ffd98a
Formatting
two-horned Nov 8, 2025
a455b3c
Be explicit about imports
two-horned Nov 8, 2025
f9bd79a
Format DerivedOps
two-horned Nov 8, 2025
1f0b2f6
Use explicit tuple declartion to avoid warnings
two-horned Nov 8, 2025
9c7283c
Eliminate warning and format
two-horned Nov 9, 2025
bae5297
Avoid warnings
two-horned Nov 10, 2025
0f6be28
Simplify list creation
two-horned Nov 10, 2025
f177e94
Simplify
two-horned Nov 10, 2025
329d75a
Formatting
two-horned Nov 10, 2025
58b9dc1
Avoid warning
two-horned Nov 10, 2025
0977200
Remove implicit conversion
two-horned Nov 10, 2025
96d9180
Simplify
two-horned Nov 13, 2025
1e55609
DerivedOps, add implicit conversions
two-horned Dec 1, 2025
1e925c3
Use processEscapes instead treatEscapes
two-horned Dec 1, 2025
c525783
Format Parsers
two-horned Dec 1, 2025
2781420
Remove unneeded type hints
two-horned Dec 1, 2025
f1bc993
Prettify Section3
two-horned Dec 1, 2025
18b61a5
Prettify Section4. Remove dangerous 'Any's
two-horned Dec 1, 2025
13a9aaa
Simplify PythonParsers
two-horned Dec 1, 2025
6ee3454
Replace wildcards with 'Any'
two-horned Dec 1, 2025
c2b46a3
Format Leftrec tests
two-horned Dec 1, 2025
074a17b
Fix greedySome: Needs NT
two-horned Dec 1, 2025
44faf49
Rename lambda variable
two-horned Dec 1, 2025
598398d
Add space
two-horned Dec 1, 2025
5a041a0
Remove type annotation for nested function
two-horned Dec 1, 2025
9fd35a8
Simplify lambda
two-horned Dec 1, 2025
9737777
Add spaces for readabilty
two-horned Dec 1, 2025
dce1018
Fix null pointer exception by using lazy val
two-horned Dec 1, 2025
0c3ca14
Reintroduce implicit conversion
two-horned Dec 1, 2025
76e283f
Simplify lambda
two-horned Dec 1, 2025
6d4b1d9
Use implicit definition to be able to use cbn for NT conversion
two-horned Dec 2, 2025
e2349d6
Ignore test output 'test.png'
two-horned Dec 2, 2025
5c0fc35
Remove with keywords
two-horned Dec 2, 2025
1c0881c
Use round parentheses
two-horned Dec 2, 2025
0ba4b0a
Simplify some expressions
two-horned Dec 2, 2025
7221b53
Use enum to for the many case classes
two-horned Dec 3, 2025
e38bcaa
Encapsulate and simplify
two-horned Dec 3, 2025
dc0cb68
Add scalafmt file for all to see
two-horned Dec 3, 2025
ef039ae
Update Vagrantfile
two-horned Dec 3, 2025
c466f16
Format NegationTests
two-horned Dec 3, 2025
22f0216
Avoid warning by replacing '~' with ','
two-horned Dec 3, 2025
8b06526
Update formatting settings
two-horned Dec 3, 2025
3da8bea
Fix formatting DerivativeParsers, multiline strings
two-horned Dec 3, 2025
7a79411
Fix most of the broken formatting
two-horned Dec 3, 2025
e68d081
Remove lambdas if possible
two-horned Dec 4, 2025
4940b6a
Use existing mkList to simplify
two-horned Dec 4, 2025
2c92651
Fix type for tests."
two-horned Dec 4, 2025
0637b6e
Fix some more formatting in PythonParserTests
two-horned Dec 4, 2025
8cfd76a
Exclude really bad cases from autoformatting.
two-horned Dec 4, 2025
835d481
Update formatting.
two-horned Dec 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@
# sbt specific
.cache
.history
.lib/
dist/*
target/
lib_managed/
src_managed/
project/boot/
project/plugins/project/

.lib
dist
target
lib_managed
src_managed
project
.scala-build

# Tooling
.project
.metals
.bsp
.bloop

# Testing
test.png
8 changes: 8 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version = "3.7.15"
runner.dialect = scala3

assumeStandardLibraryStripMargin = true
align.stripMargin = true

binPack.unsafeCallSite = true
binPack.literalArgumentLists = true
19 changes: 9 additions & 10 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,21 @@ Vagrant.configure(2) do |config|

config.vm.provision "shell", inline: <<-SHELL

# Refresh sources
# Refresh system
sudo apt-get update -y
sudo apt-get upgrade -y

# Graphviz for printing parsers to graphs
sudo apt-get install -y graphviz

# Java
sudo apt-get install -y openjdk-7-jdk

# Sbt
sudo mkdir -p /home/vagrant/bin
pushd /home/vagrant/bin/
sudo wget https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/0.13.8/sbt-launch.jar
sudo cp /home/vagrant/configs/sbt.sh /home/vagrant/bin/sbt
sudo chmod u+x /home/vagrant/bin/sbt
sudo chmod +x /home/vagrant/bin/sbt
sudo apt-get install -y apt-transport-https curl gnupg
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee /etc/apt/sources.list.d/sbt_old.list
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo -H gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/scalasbt-release.gpg --import
sudo chmod 644 /etc/apt/trusted.gpg.d/scalasbt-release.gpg
sudo apt-get update -y
sudo apt-get install -y sbt
popd
SHELL

Expand Down
13 changes: 6 additions & 7 deletions artifact/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@ name := "first-class-derivatives"

version := "1.0"

scalaVersion := "2.11.7"
scalaVersion := "3.7.3"

scalacOptions ++= Seq("-feature", "-deprecation")

libraryDependencies += "org.scalatest" %% "scalatest" % "2.2.4" % "test"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.19" % "test"

resolvers += "Sonatype OSS Snapshots" at
"https://oss.sonatype.org/content/repositories/releases"
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/releases"

parallelExecution in Test := true
Test / parallelExecution := true

libraryDependencies += "org.scala-lang.modules" % "scala-xml_2.11" % "1.0.5"
libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "2.4.0"

initialCommands in console := """import fcd._; import fcd.DerivativeParsers._"""
console / initialCommands := """import fcd._; import fcd.DerivativeParsers._"""

// For VM users on windows systems, please uncomment the following line:
// target := file("/home/vagrant/target/")
1 change: 0 additions & 1 deletion artifact/project/build.properties

This file was deleted.

37 changes: 18 additions & 19 deletions artifact/src/main/scala/examples/PythonAst.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,24 @@ trait PythonAst {
case class Decorated(decorators: Seq[Decorator], el: Any) extends Tree

trait Def extends Tree
case class FuncDef(name: Any, params: Any, retAnnot: Option[Any], body: Any) extends Def

trait Stmt extends Tree
case class Simple(small: Seq[Any]) extends Stmt

case class Del(exprs: Seq[Any]) extends Stmt
case object Pass extends Stmt
case object Break extends Stmt
case object Continue extends Stmt
case class Return(expr: Option[Any]) extends Stmt
case class Raise(expr: Option[Any]) extends Stmt
case class ExprStmt(expr: Any) extends Stmt
case class Import(names: Any, from: Option[Any] = None) extends Stmt

case class Global(ids: Seq[Any]) extends Stmt
case class Nonlocal(ids: Seq[Any]) extends Stmt
case class Assert(tests: Seq[Any]) extends Stmt

case class For(exprs: Seq[Any], in: Any, body: Any, default: Any) extends Stmt
case class FuncDef(name: Any, params: Any, retAnnot: Option[Any], body: Any)
extends Def

enum Stmt extends Tree {
case Simple(small: Seq[Any])
case Del(exprs: Seq[Any])
case Pass
case Break
case Continue
case Return(expr: Option[Any])
case Raise(expr: Option[Any])
case ExprStmt(expr: Any)
case Import(names: Any, from: Option[Any] = None)
case Global(ids: Seq[Any])
case Nonlocal(ids: Seq[Any])
case Assert(tests: Seq[Any])
case For(exprs: Seq[Any], in: Any, body: Any, default: Any)
}

trait Expr extends Tree
case class BinOp(l: Any, op: Any, r: Any) extends Expr
Expand Down
Loading