Skip to content

Commit

Permalink
fix(#3050): lambda name and test
Browse files Browse the repository at this point in the history
  • Loading branch information
maxonfjvipon committed Apr 5, 2024
1 parent 5f3b70f commit 4fd8198
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 8 deletions.
3 changes: 0 additions & 3 deletions eo-maven-plugin/src/main/java/org/eolang/maven/PhiMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,6 @@ count, new Rel(this.phiInputDir), new Rel(this.phiOutputDir)
*/
private static String translated(final Train<Shift> train, final XML xmir)
throws ImpossibleToPhiTranslationException {
System.out.println(
new Xsline(train).pass(xmir)
);
final XML translated = new Xsline(
train.with(new StClasspath("/org/eolang/maven/phi/to-phi.xsl"))
).pass(xmir);
Expand Down
14 changes: 11 additions & 3 deletions eo-maven-plugin/src/main/resources/org/eolang/maven/phi/to-phi.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ SOFTWARE.
<xsl:text>.</xsl:text>
</xsl:if>
</xsl:function>
<!-- Get clean escaped object name -->
<xsl:function name="eo:lambda-name">
<xsl:param name="name"/>
<xsl:value-of select="concat('L', replace(replace(replace(substring($name, 3), '\.', '_'), '-', '_'), '@', 'φ'))"/>
</xsl:function>
<!-- SPECIAL CHARACTERS -->
<xsl:function name="eo:specials">
<xsl:param name="n"/>
Expand Down Expand Up @@ -359,11 +364,14 @@ SOFTWARE.
<xsl:value-of select="eo:eol($tabs+1)"/>
<!-- Atom -->
<xsl:if test="@atom">
<xsl:variable name="lambda-name">
<xsl:value-of select="$package"/>
<xsl:text>.</xsl:text>
<xsl:value-of select="$name"/>
</xsl:variable>
<xsl:value-of select="$lambda"/>
<xsl:value-of select="$dashed-arrow"/>
<xsl:value-of select="$package"/>
<xsl:text>.</xsl:text>
<xsl:value-of select="$name"/>
<xsl:value-of select="eo:lambda-name($lambda-name)"/>
<xsl:if test="count(o)&gt;0">
<xsl:value-of select="eo:comma(2, $tabs+1)"/>
</xsl:if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ phi: |
{
main ↦ ⟦
λ ⤍ Lambda
λ ⤍ Lmain
⟧,
outer ↦ ⟦
inner ↦ ⟦
λ ⤍ Lambda
λ ⤍ Louter_inner
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
eo: |
+architect [email protected]
+home https://github.com/objectionary/eo
+package org.eolang
+rt jvm org.eolang:eo-runtime:0.0.0
+version 0.0.0
# This is the default 64+ symbols comment in front of named abstract object.
[] > bytes
# This is the default 64+ symbols comment in front of named abstract object.
[x] > eq /bool
# This is the default 64+ symbols comment in front of named abstract object.
[] > size /int
# This is the default 64+ symbols comment in front of named abstract object.
[start len] > slice /bytes
# This is the default 64+ symbols comment in front of named abstract object.
[] > as-string /string
# Turn this chain of eight bytes into an integer.
# If there are less or more than eight bytes, there will
# be an error returned.
[] > as-int /int
# Turn this chain of eight bytes into a float.
# If there are less or more than eight bytes, there will
# be an error returned.
[] > as-float /float
# This is the default 64+ symbols comment in front of named abstract object.
[b] > and /bytes
# This is the default 64+ symbols comment in front of named abstract object.
[b] > or /bytes
# This is the default 64+ symbols comment in front of named abstract object.
[b] > xor /bytes
# This is the default 64+ symbols comment in front of named abstract object.
[] > not /bytes
# This is the default 64+ symbols comment in front of named abstract object.
[x] > left
^.right x.neg > @
# This is the default 64+ symbols comment in front of named abstract object.
[x] > right /bytes
# This is the default 64+ symbols comment in front of named abstract object.
[] > as-bool
^.eq 01- > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > as-bytes
^ > @
# Concatenation of two byte sequences:
# the current and the provided one,
# as a new sequence.
[b] > concat /bytes
phi: |
{
org ↦ ⟦
eolang ↦ ⟦
bytes ↦ ⟦
eq ↦ ⟦
λ ⤍ Lorg_eolang_bytes_eq,
x ↦ ∅
⟧,
size ↦ ⟦
λ ⤍ Lorg_eolang_bytes_size
⟧,
slice ↦ ⟦
λ ⤍ Lorg_eolang_bytes_slice,
start ↦ ∅,
len ↦ ∅
⟧,
as-string ↦ ⟦
λ ⤍ Lorg_eolang_bytes_as_string
⟧,
as-int ↦ ⟦
λ ⤍ Lorg_eolang_bytes_as_int
⟧,
as-float ↦ ⟦
λ ⤍ Lorg_eolang_bytes_as_float
⟧,
and ↦ ⟦
λ ⤍ Lorg_eolang_bytes_and,
b ↦ ∅
⟧,
or ↦ ⟦
λ ⤍ Lorg_eolang_bytes_or,
b ↦ ∅
⟧,
xor ↦ ⟦
λ ⤍ Lorg_eolang_bytes_xor,
b ↦ ∅
⟧,
not ↦ ⟦
λ ⤍ Lorg_eolang_bytes_not
⟧,
left ↦ ⟦
x ↦ ∅,
φ ↦ ξ.ρ.right(
α0 ↦ ξ.x.neg
)
⟧,
right ↦ ⟦
λ ⤍ Lorg_eolang_bytes_right,
x ↦ ∅
⟧,
as-bool ↦ ⟦
φ ↦ ξ.ρ.eq(
α0 ↦ ξ.σ.σ.Φ.org.eolang.bytes(
Δ ⤍ 01-
)
)
⟧,
as-bytes ↦ ⟦
φ ↦ ξ.ρ
⟧,
concat ↦ ⟦
λ ⤍ Lorg_eolang_bytes_concat,
b ↦ ∅
⟧,
λ ⤍ Package
⟧,
λ ⤍ Package
}

0 comments on commit 4fd8198

Please sign in to comment.