Measures Concepts
GitHub icon

Smali

Smali - Assembly language

< >

Smali is an open source assembly language created in 2010.

Source code:
git clone https://github.com/JesusFreke/smali
#93on PLDB 14Years Old 2kRepos

smali/baksmali


Example from the web:
.method public getTokens(I)I .locals 2 .param p1, "amt" # I .prologue const/4 v0, 0x0 .line 512 iget-boolean v1, p0, Lcom/limbenjamin/Example;->isPaid:Z if-nez v1, :cond_1 .line 514 :cond_0 :goto_0 return v0 .line 513 :cond_1 iget-object v1, p0, Lcom/limbenjamin/Example;->handler:Lcom/limbenjamin/ExampleHandler; if-eqz v1, :cond_0 .line 514 move v3, p1 iget-object v0, p0, Lcom/limbenjamin/Example;->handler:Lcom/limbenjamin/ExampleHandler; invoke-interface {v0, v3}, Lcom/limbenjamin/ExampleHandler;->creditTokens(I)V move-result v0 goto :goto_0 .end method
Example from hello-world:
.class public LHelloWorld; .super Ljava/lang/Object; .method public static main([Ljava/lang/String;)V .registers 2 sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; const-string v1, "Hello World" invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V return-void .end method
Example from Linguist:
.class public Lcom/tdq/game/shootbubble/sprite/PenguinSprite; .super Lcom/tdq/game/shootbubble/sprite/Sprite; .source "PenguinSprite.java" # static fields .field public static final LOST_SEQUENCE:[[I .field public static final STATE_FIRE:I = 0x2 .field public static final STATE_GAME_LOST:I = 0x5 .field public static final STATE_GAME_WON:I = 0x4 .field public static final STATE_TURN_LEFT:I = 0x0 .field public static final STATE_TURN_RIGHT:I = 0x1 .field public static final STATE_VOID:I = 0x3 .field public static final WON_SEQUENCE:[[I # instance fields .field private count:I .field private currentPenguin:I .field private finalState:I .field private nextPosition:I .field private rand:Ljava/util/Random; .field private spritesImage:Lcom/tdq/game/shootbubble/sprite/BmpWrap; # direct methods .method static constructor <clinit>()V .locals 8 .prologue const/4 v7, 0x4 const/4 v6, 0x3 const/4 v5, 0x1 const/4 v4, 0x0 const/4 v3, 0x2 .line 67 const/16 v0, 0x8 new-array v0, v0, [[I new-array v1, v3, [I fill-array-data v1, :array_0 aput-object v1, v0, v4 new-array v1, v3, [I fill-array-data v1, :array_1 aput-object v1, v0, v5 new-array v1, v3, [I fill-array-data v1, :array_2 aput-object v1, v0, v3 new-array v1, v3, [I fill-array-data v1, :array_3 aput-object v1, v0, v6 new-array v1, v3, [I fill-array-data v1, :array_4 aput-object v1, v0, v7 const/4 v1, 0x5 new-array v2, v3, [I fill-array-data v2, :array_5 aput-object v2, v0, v1 const/4 v1, 0x6 new-array v2, v3, [I fill-array-data v2, :array_6 aput-object v2, v0, v1 const/4 v1, 0x7 new-array v2, v3, [I fill-array-data v2, :array_7 aput-object v2, v0, v1 sput-object v0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->LOST_SEQUENCE:[[I .line 69 const/16 v0, 0x8 new-array v0, v0, [[I new-array v1, v3, [I fil

Language features

Feature Supported Token Example
Strings ✓ "
"Hello world"
Comments ✓
# A comment
Line Comments ✓ #
# A comment
Semantic Indentation X

View source

- Build the next great programming language · Search · Add Language · Features · Creators · Resources · About · Blog · Acknowledgements · Queries · Stats · Sponsor · Day 605 · feedback@pldb.io · Logout