Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State supported formats clearly #9

Merged
merged 6 commits into from
Mar 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# CLANG Parser

Parses C source code to create an abstract syntax tree.
The definition of "small C", the language to be parsed, is as follows:

```
#include
#define

P ::= x=e; | if (b) P else P | while (b) P | for (e; e; e) P | return e; | return;
| { P ... P }
e ::= int-constants (..., -1, 0, 1, 2, ...) | variables | a[e]
for array name a
| e + e | e - e | e * e | e / e | e % e | (e) | f(e, ..., e)
for function name f
b ::= e == e | e != e | e < e | e > e | e <= e | e >= e | (e) | !e
| e && e | e '||' e

type ::= void | int
次元配列
関数定義と呼び出し
グローバル変数
ローカル変数 (関数定義のはじめだけ)
```

## Requirement

* clang plugin by facebook infer
Expand Down
9 changes: 9 additions & 0 deletions sample/import1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
int sum(int a, int b)
{
return a + b;
}

int product(int a, int b)
{
return a * b;
}
3 changes: 3 additions & 0 deletions sample/import1.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
int sum(int a, int b);

int product(int a, int b);
11 changes: 11 additions & 0 deletions sample/import2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "import1.h"

int test()
{
int a, b, c, d;
a = 42;
b = 99;
c = sum(a, b);
d = product(c, d);
return c + d;
}
Loading