diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8dab695 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +a.s +a.out +.gitignore diff --git a/README.md b/README.md deleted file mode 100644 index d921ba5..0000000 --- a/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# TComp -A practice of Essential of Complication in Julia - -## Dependencies - - julia - - [Match.jl](github.com/JuliaServices/Match.jl) - -## instruction -`./src/TComp.jl [.tc file]` - -the output assembly code is `./a.c` in AT&T assembly langauge. - -to make it executable, please use `gcc`: `gcc ./a.c -o output.out` - -the example `.tc` files is in `./test` - -## Known issues - - all connected variable are pathized (I don't understand the tricky method to elimitated the path number) diff --git a/misc/vertexcoloring.jl b/misc/vertexcoloring.jl deleted file mode 100644 index dab4f04..0000000 --- a/misc/vertexcoloring.jl +++ /dev/null @@ -1,59 +0,0 @@ -graph = [['a', 'b'], ['b', 'c'], ['e', 'd'], ['e', 'a'], ['a', 'c'], ['b','e'], ['e','c']] - - -function vertexColoring(graph) - notDefined = -1 - - function getColor(v, color) - if !(v in keys(color)) - return -1 - else - return color[v] - end - end - - vertices = Set(vcat(graph...)) - verticesList = collect(vertices) - - verticesMapping = map(x -> [x, Set()], verticesList) - - adjacentNodes = Dict(verticesMapping) - - for link in graph - a = link[1] - b = link[2] - push!(adjacentNodes[a], b) - push!(adjacentNodes[b], a) - end - - sort!(verticesList, by=x -> length(adjacentNodes[x]), rev=true) - - color = Dict() - - println(verticesList) - - - for i in verticesList - i_adjacents = adjacentNodes[i] - println(i_adjacents) - i_adjacents_color_set = Set(map(x -> getColor(x, color), collect(i_adjacents))) - i_adjacents_color_list = sort(collect(i_adjacents_color_set)) - - if i_adjacents_color_list == [notDefined] - color[i] = 0 - else - tmpId = 0 - for i in i_adjacents_color_list - if tmpId == i - tmpId += 1 - end - end - color[i] = tmpId - end - end - - return color - -end - -println(vertexColoring(graph)) \ No newline at end of file