<commit_before># ARM C Compiler (ACC)
[![Build Status](https://travis-ci.org/maitesin/acc.svg?branch=master)](https://travis-ci.org/maitesin/acc)
<a href="https://scan.coverity.com/projects/arm-c-compiler">
  <img alt="Coverity Scan Build Status" src="https://scan.coverity.com/projects/7891/badge.svg"/>
</a>
[![codecov](https://codecov.io/gh/maitesin/acc/branch/master/graph/badge.svg)](https://codecov.io/gh/maitesin/acc)


**ACC** is a project that its only aim is to improve my knowledge of two topics, C language and ARM assembly. I think this is a good exercise to go deep into both topics.

# Parser
The **ACC** is a **LALR(1) parser**, that means it is a [**Look-Ahead Left-to-Right parser**](https://en.wikipedia.org/wiki/LALR_parser).

# Grammar
```
S -> int main "(" ")" "{" E "}"
E -> return I;
     | if "(" B ")" "{" E "}"
     | if "(" B ")" "{" E "}" else "{" E "}"
I -> [0-9]+
B -> I < I
     | I <= I
     | I == I
     | I >= I
     | I > I
     | ! B
     | "(" B ")"
```

# Example
C code:
```c
int main()
{
    if (1 < 2)
    {
	    if (4 > 10)
	    {
		return 1;
	    }
	    else {
		return 2;
	    }
    }
    return 0;
```
Assembly generated:
```asm
	.text
	.global main
main:
	mov r0, #1
	mov r1, #2
	cmp r0, r1<commit_msg>Some code was not copied<commit_after># ARM C Compiler (ACC)
[![Build Status](https://travis-ci.org/maitesin/acc.svg?branch=master)](https://travis-ci.org/maitesin/acc)
<a href="https://scan.coverity.com/projects/arm-c-compiler">
  <img alt="Coverity Scan Build Status" src="https://scan.coverity.com/projects/7891/badge.svg"/>
</a>
[![codecov](https://codecov.io/gh/maitesin/acc/branch/master/graph/badge.svg)](https://codecov.io/gh/maitesin/acc)


**ACC** is a project that its only aim is to improve my knowledge of two topics, C language and ARM assembly. I think this is a good exercise to go deep into both topics.

# Parser
The **ACC** is a **LALR(1) parser**, that means it is a [**Look-Ahead Left-to-Right parser**](https://en.wikipedia.org/wiki/LALR_parser).

# Grammar
```
S -> int main "(" ")" "{" E "}"
E -> return I;
     | if "(" B ")" "{" E "}"
     | if "(" B ")" "{" E "}" else "{" E "}"
I -> [0-9]+
B -> I < I
     | I <= I
     | I == I
     | I >= I
     | I > I
     | ! B
     | "(" B ")"
```

# Example
C code:
```c
int main()
{
    if (1 < 2)
    {
	    if (4 > 10)
	    {
		return 1;
	    }
	    else {
		return 2;
	    }
    }
    return 0;
}
```
Assembly generated:
```asm
	.text
	.global main
main:
	mov r0, #1
	mov r1, #2
	cmp r0, r1
{'fraction_non_alphanumeric': 0.20413847990449663, 'fraction_numerical': 0.016713091922005572, 'mean_word_length': 2.622478386167147, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 23, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3120912', 'n_tokens_mistral': 1031, 'n_tokens_neox': 982, 'n_words': 267}