Skip to content

Commit

Permalink
123
Browse files Browse the repository at this point in the history
  • Loading branch information
Hummel009 committed Feb 7, 2024
1 parent c86ed87 commit c450a8d
Show file tree
Hide file tree
Showing 87 changed files with 261 additions and 261 deletions.
6 changes: 3 additions & 3 deletions appLab1/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
id("application")
}

group = "hummel"
group = "com.github.hummel"
version = LocalDate.now().format(DateTimeFormatter.ofPattern("yy.MM.dd"))

val embed: Configuration by configurations.creating
Expand All @@ -26,7 +26,7 @@ java {
}

application {
mainClass = "hummel.MainKt"
mainClass = "com.github.hummel.msciit.lab1.MainKt"
}

tasks {
Expand All @@ -37,7 +37,7 @@ tasks {
manifest {
attributes(
mapOf(
"Main-Class" to "hummel.MainKt"
"Main-Class" to "com.github.hummel.msciit.lab1.MainKt"
)
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hummel
package com.github.hummel.msciit.lab1

import java.io.File
import kotlin.math.log2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hummel
package com.github.hummel.msciit.lab1

import com.formdev.flatlaf.FlatLightLaf
import com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatGitHubDarkIJTheme
Expand Down
6 changes: 3 additions & 3 deletions appLab2/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
id("application")
}

group = "hummel"
group = "com.github.com.github.hummel.msciit.lab2"
version = LocalDate.now().format(DateTimeFormatter.ofPattern("yy.MM.dd"))

val embed: Configuration by configurations.creating
Expand All @@ -26,7 +26,7 @@ java {
}

application {
mainClass = "hummel.MainKt"
mainClass = "com.github.com.github.hummel.msciit.lab2.msciit.lab2.MainKt"
}

tasks {
Expand All @@ -37,7 +37,7 @@ tasks {
manifest {
attributes(
mapOf(
"Main-Class" to "hummel.MainKt"
"Main-Class" to "com.github.com.github.hummel.msciit.lab2.msciit.lab2.MainKt"
)
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hummel
package com.github.hummel.msciit.lab2

import java.util.*

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package hummel
package com.github.hummel.msciit.lab2

import com.formdev.flatlaf.FlatLightLaf
import com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatGitHubDarkIJTheme
import hummel.lexer.Lexer
import hummel.parser.RParser
import com.github.hummel.msciit.lab2.lexer.Lexer
import com.github.hummel.msciit.lab2.parser.RParser
import java.awt.BorderLayout
import java.awt.EventQueue
import java.awt.GridLayout
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package hummel.inter
package com.github.hummel.msciit.lab2.inter

import hummel.lexer.Token
import hummel.symbols_types.Type
import com.github.hummel.msciit.lab2.lexer.Token
import com.github.hummel.msciit.lab2.symbols_types.Type

class Arithmetic(token: Token, private var expr1: Expression, private var expr2: Expression) : Operation(token, null) {
init {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package hummel.inter
package com.github.hummel.msciit.lab2.inter

import hummel.lexer.Num
import hummel.lexer.Token
import hummel.lexer.Word
import hummel.symbols_types.Type
import com.github.hummel.msciit.lab2.lexer.Num
import com.github.hummel.msciit.lab2.lexer.Token
import com.github.hummel.msciit.lab2.lexer.Word
import com.github.hummel.msciit.lab2.symbols_types.Type

class Constant(token: Token, type: Type?) : Expression(token, type) {
constructor(value: Int) : this(Num(value), Type.INT)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package hummel.inter
package com.github.hummel.msciit.lab2.inter

import hummel.lexer.Token
import hummel.symbols_types.Type
import com.github.hummel.msciit.lab2.lexer.Token
import com.github.hummel.msciit.lab2.symbols_types.Type

open class Expression(var token: Token, var type: Type?) : Node() {
open fun gen(): Expression = this
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.github.hummel.msciit.lab2.inter

import com.github.hummel.msciit.lab2.lexer.Word
import com.github.hummel.msciit.lab2.symbols_types.Type

class Id(word: Word, type: Type?) : Expression(word, type)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package hummel.inter
package com.github.hummel.msciit.lab2.inter

import hummel.lexer.Lexer
import com.github.hummel.msciit.lab2.lexer.Lexer

open class Node {
private var lexerLine = 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package hummel.inter
package com.github.hummel.msciit.lab2.inter

import hummel.lexer.Token
import hummel.symbols_types.Type
import com.github.hummel.msciit.lab2.lexer.Token
import com.github.hummel.msciit.lab2.symbols_types.Type

open class Operation(token: Token, type: Type?) : Expression(token, type) {
override fun reduce(): Expression {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package hummel.inter
package com.github.hummel.msciit.lab2.inter

import hummel.lexer.Word
import hummel.symbols_types.Type
import com.github.hummel.msciit.lab2.lexer.Word
import com.github.hummel.msciit.lab2.symbols_types.Type

class Temp(type: Type?) : Expression(Word.TEMP, type) {
private var number = 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package hummel.inter
package com.github.hummel.msciit.lab2.inter

import hummel.lexer.Token
import hummel.symbols_types.Type
import com.github.hummel.msciit.lab2.lexer.Token
import com.github.hummel.msciit.lab2.symbols_types.Type

class Unary(token: Token, var expr: Expression) : Operation(token, null) {
init {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.github.hummel.msciit.lab2.inter.boolean

import com.github.hummel.msciit.lab2.inter.Expression
import com.github.hummel.msciit.lab2.inter.Id
import com.github.hummel.msciit.lab2.inter.Operation
import com.github.hummel.msciit.lab2.lexer.Tag
import com.github.hummel.msciit.lab2.lexer.Word
import com.github.hummel.msciit.lab2.symbols_types.Type

class Access(private var id: Id, var expr: Expression, type: Type?) : Operation(Word("[]", Tag.INDEX), type) {
override fun gen(): Expression = Access(id, expr.reduce(), type)

override fun jumping(t: Int, f: Int): Unit = emitJumps("${reduce()}", t, f)

override fun toString(): String = "$id [ $expr ] "
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package hummel.inter.boolean
package com.github.hummel.msciit.lab2.inter.boolean

import hummel.inter.Expression
import hummel.lexer.Token
import com.github.hummel.msciit.lab2.inter.Expression
import com.github.hummel.msciit.lab2.lexer.Token

class And(token: Token, expr1: Expression, expr2: Expression) : Logical(token, expr1, expr2) {
override fun jumping(t: Int, f: Int) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package hummel.inter.boolean
package com.github.hummel.msciit.lab2.inter.boolean

import hummel.inter.Expression
import hummel.inter.Temp
import hummel.lexer.Token
import hummel.symbols_types.Type
import com.github.hummel.msciit.lab2.inter.Expression
import com.github.hummel.msciit.lab2.inter.Temp
import com.github.hummel.msciit.lab2.lexer.Token
import com.github.hummel.msciit.lab2.symbols_types.Type

open class Logical(token: Token, var expr1: Expression, var expr2: Expression) : Expression(token, null) {
init {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package hummel.inter.boolean
package com.github.hummel.msciit.lab2.inter.boolean

import hummel.inter.Expression
import hummel.lexer.Token
import com.github.hummel.msciit.lab2.inter.Expression
import com.github.hummel.msciit.lab2.lexer.Token

class Not(token: Token, expr: Expression) : Logical(token, expr, expr) {
override fun jumping(t: Int, f: Int): Unit = expr2.jumping(f, t)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package hummel.inter.boolean
package com.github.hummel.msciit.lab2.inter.boolean

import hummel.inter.Expression
import hummel.lexer.Token
import com.github.hummel.msciit.lab2.inter.Expression
import com.github.hummel.msciit.lab2.lexer.Token

class Or(token: Token, expr1: Expression, expr2: Expression) : Logical(token, expr1, expr2) {
override fun jumping(t: Int, f: Int) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package hummel.inter.boolean
package com.github.hummel.msciit.lab2.inter.boolean

import hummel.inter.Expression
import hummel.lexer.Token
import hummel.symbols_types.Array
import hummel.symbols_types.Type
import com.github.hummel.msciit.lab2.inter.Expression
import com.github.hummel.msciit.lab2.lexer.Token
import com.github.hummel.msciit.lab2.symbols_types.Array
import com.github.hummel.msciit.lab2.symbols_types.Type

class Rel(token: Token, expr1: Expression, expr2: Expression) : Logical(token, expr1, expr2) {
init {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hummel.inter.statements
package com.github.hummel.msciit.lab2.inter.statements

class Break : Statement() {
private var state: Statement? = enclosing
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package hummel.inter.statements
package com.github.hummel.msciit.lab2.inter.statements

import hummel.inter.Expression
import com.github.hummel.msciit.lab2.inter.Expression

class Case(var expr: Expression, var state: Statement?) : Statement() {
private var whens: MutableList<Statement> = ArrayList()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package hummel.inter.statements
package com.github.hummel.msciit.lab2.inter.statements

import hummel.inter.Expression
import hummel.symbols_types.Type
import com.github.hummel.msciit.lab2.inter.Expression
import com.github.hummel.msciit.lab2.symbols_types.Type

class Else(private val expr: Expression, private val state1: Statement, private val state2: Statement) : Statement() {
init {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package hummel.inter.statements
package com.github.hummel.msciit.lab2.inter.statements

import hummel.inter.Expression
import hummel.symbols_types.Type
import com.github.hummel.msciit.lab2.inter.Expression
import com.github.hummel.msciit.lab2.symbols_types.Type

class If(private val expr: Expression, private val state: Statement) : Statement() {
init {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hummel.inter.statements
package com.github.hummel.msciit.lab2.inter.statements

class Loop : Statement() {
private var state: Statement? = null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package hummel.inter.statements
package com.github.hummel.msciit.lab2.inter.statements

import hummel.inter.Expression
import com.github.hummel.msciit.lab2.inter.Expression

class Puts(var expr: Expression?, private var str: String) : Statement() {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hummel.inter.statements
package com.github.hummel.msciit.lab2.inter.statements

class Sequence(private val state1: Statement, private val state2: Statement) : Statement() {
override fun gen(b: Int, a: Int) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package hummel.inter.statements
package com.github.hummel.msciit.lab2.inter.statements

import hummel.inter.Expression
import hummel.inter.Id
import hummel.symbols_types.Type
import com.github.hummel.msciit.lab2.inter.Expression
import com.github.hummel.msciit.lab2.inter.Id
import com.github.hummel.msciit.lab2.symbols_types.Type

class Set(private var id: Id, var expr: Expression) : Statement() {
init {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package hummel.inter.statements
package com.github.hummel.msciit.lab2.inter.statements

import hummel.inter.Node
import com.github.hummel.msciit.lab2.inter.Node

open class Statement : Node() {
var after: Int = 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package hummel.inter.statements
package com.github.hummel.msciit.lab2.inter.statements

import hummel.inter.Expression
import com.github.hummel.msciit.lab2.inter.Expression

class Until : Statement() {
private var expr: Expression? = null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package hummel.inter.statements
package com.github.hummel.msciit.lab2.inter.statements

import hummel.inter.Expression
import com.github.hummel.msciit.lab2.inter.Expression

class When(var expr: Expression, private val state: Statement) : Statement() {
var nextL: Int = 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package hummel.inter.statements
package com.github.hummel.msciit.lab2.inter.statements

import hummel.inter.Expression
import hummel.symbols_types.Type
import com.github.hummel.msciit.lab2.inter.Expression
import com.github.hummel.msciit.lab2.symbols_types.Type

class While : Statement() {
private var expr: Expression? = null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package hummel.lexer
package com.github.hummel.msciit.lab2.lexer

import hummel.symbols_types.Type
import com.github.hummel.msciit.lab2.symbols_types.Type
import java.io.BufferedReader
import java.io.FileReader
import java.util.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hummel.lexer
package com.github.hummel.msciit.lab2.lexer

class Num(val int: Int) : Token(Tag.NUM.code) {
override fun toString(): String = "$int"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hummel.lexer
package com.github.hummel.msciit.lab2.lexer

class Real(private val float: Float) : Token(Tag.FLOAT.code) {
override fun toString(): String = "$float"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hummel.lexer
package com.github.hummel.msciit.lab2.lexer

enum class Tag(val code: Int) {
AND(1025),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hummel.lexer
package com.github.hummel.msciit.lab2.lexer

open class Token(val tag: Int) {
override fun toString(): String = tag.toChar().toString()
Expand Down
Loading

0 comments on commit c450a8d

Please sign in to comment.